Skip to content

Repository files navigation

Worldpay-API

PHP SDK for Worldpay API

Installation

You can use composer to use this library in other projects. As this package is not on packagist, you have to add this github repo to your repositories in your projects composer.json:

"repositories": [
        {
            "type": "vcs",
            "url":  "git@github.com:2525VenturesBV/Worldpay-API.git"
        }
    ]

Then you can add it as a normal requirement:

composer require 2525ventures/worldpay-api:dev-develop

Make a request

For detailed information on requests, see the Worldpay docs

  1. Create a client with your credentials

    $worldpay = new \Worldpay\Core\WorldPay($config);
  2. Make a request with your data

    $response = $worldpay->sendOrderRequest($data);
    
  3. Read the response:
    If the call was successful you retrieve a Worldpay\Responses\OrderResponse.

    Use $response->getRawResponse() to retrieve the original Guzzle response. You can find more info on Guzzle response here

    With $response->getTransactionId() and $response->getRedirectUrl() you can directly get the important values from the response.

    On error you will get a WorldpayException.

Todo

  • Make a more sophisticated error handling
  • Improve configuration setup, this is now done through an array, which doesn't feel right
  • Implement other calls from Worldpay
  • Callback URL: the callback URL is not set, so a user cannot be redirected back to litebit if the payment is successful
  • Change PHPUnit to Codeception

About

PHP SDK for Worldpay composer package

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages