| Package Data | |
|---|---|
| Maintainer Username: | Sheikh-Alvee | 
| Maintainer Contact: | imran.sheikh834@gmail.com (Imran Saleem) | 
| Package Create Date: | 2016-11-14 | 
| Package Last Update: | 2017-03-21 | 
| Home Page: | http://worldpay.com | 
| Language: | PHP | 
| License: | MIT | 
| Last Refreshed: | 2025-10-30 03:00:53 | 
| Package Statistics | |
|---|---|
| Total Downloads: | 8,828 | 
| Monthly Downloads: | 1 | 
| Daily Downloads: | 0 | 
| Total Stars: | 4 | 
| Total Watchers: | 2 | 
| Total Forks: | 0 | 
| Total Open Issues: | 2 | 
Laravel WorldPay Payment is a simple package that helps you to process WorldPay direct credit card payments, create orders and get orders with your Laravel 5 projects.
Install this package through Composer. To your composer.json file, add:
"require": {
    "alvee/worldpay": "@dev"
}
$ composer update
Or
$ composer require alvee/worldpay:@dev
Then add the service provider in config/app.php:
Alvee\WorldPay\WorldPayServiceProvider::class,
Finally Publish the package configuration by running this CMD
php artisan vendor:publish
Now go to config/worldpay.php.
Set your SDK configuration.
server = sandbox or live
Account credentials from developer portal
[Test Account]
sandbox.service = T_C_8b253cda-26d5-4917-bc39-6224c07d63tc
sandbox.client = T_C_8b253cda-26d5-4917-bc39-6224c07d63tc
[Live Account]
live.service = T_C_8b253cda-26d5-4917-bc39-6224c07d63tc
live.client = T_C_8b253cda-26d5-4917-bc39-6224c07d63tc
Copy routes and paste in your route file
Route::get('/worldpay', function () {
    return view('vendor/alvee/worldpay');
});
Route::post('/charge', function (\Illuminate\Http\Request $request) {
    $token    = $request->input( 'token' );
    $total    = 50;
    $key      = config('worldpay.sandbox.client');
    $worldPay = new Alvee\WorldPay\lib\Worldpay($key);
    $billing_address = array(
        'address1'    => 'Address 1 here',
        'address2'    => 'Address 2 here',
        'address3'    => 'Address 3 here',
        'postalCode'  => 'postal code here',
        'city'        => 'city here',
        'state'       => 'state here',
        'countryCode' => 'GB',
    );
    try {
        $response = $worldPay->createOrder(array(
            'token'             => $token,
            'amount'            => (int)($total . "00"),
            'currencyCode'      => 'GBP',
            'name'              => "Name on Card",
            'billingAddress'    => $billing_address,
            'orderDescription'  => 'Order description',
            'customerOrderCode' => 'Order code'
        ));
        if ($response['paymentStatus'] === 'SUCCESS') {
            $worldpayOrderCode = $response['orderCode'];
            
           echo "<pre>";
           print_r($response);
        } else {
            // The card has been declined
            throw new \Alvee\WorldPay\lib\WorldpayException(print_r($response, true));
        }
    } catch (Alvee\WorldPay\lib\WorldpayException $e) {
        echo 'Error code: ' . $e->getCustomCode() . '
              HTTP status code:' . $e->getHttpStatusCode() . '
              Error description: ' . $e->getDescription() . '
              Error message: ' . $e->getMessage();
        // The card has been declined
    } catch (\Exception $e) {
        // The card has been declined
        echo 'Error message: ' . $e->getMessage();
    }
});
Please see CHANGELOG for more information what has changed recently.
If you discover any security related issues, please email imran.sheikh834@gmail.com instead of using the issue tracker.