Menu

Creating a world payment method order

World payment method order

Example request

Copied!
curl https://api.worldpay.com/v1/orders 
-H "Authorization:your-service-key" 
-H "Content-type: application/json" 
-X POST -d '{
    "token" : "your-WPM-token",
    "orderType" : "ECOM",
    "amount" : 500,
    "currencyCode" : "GBP",
    "orderDescription" : "Order description",
    "customerOrderCode":"Order code"
    "name" : "John Smith",
    "billingAddress" : {
        "address1" : "address1",
        "postalCode" : "postCode",
        "city" : "city",
        "countryCode" : "GB"
    },
    "deliveryAddress": {
        "firstName": "John",
        "lastName": "Smith",
        "address1": "address1",
        "postalCode": "postCode",
        "city": "city",
        "countryCode": "GB",
        "telephoneNumber": "02079460761"
    },
    "successUrl": "https://www.yourwebsite.co.uk/success",
    "pendingUrl": "https://www.yourwebsite.co.uk/pending",
    "failureUrl": "https://www.yourwebsite.co.uk/failure",
    "cancelUrl": "https://www.yourwebsite.co.uk/cancel",
    "shopperEmailAddress": "email address",
    "shopperIpAddress": "181.22.191.56",
    "shopperSessionId" : "unique-session-id"
}'

Example response

Copied!
{
    "orderCode": "worldpay-order-code",
    "token" : "your-WPM-token",
    "orderDescription" : "your-order-description",
    "amount" : 500,
    "currencyCode" : "GBP",
    "customerOrderCode":"my-customer-order-code",
    "paymentStatus": "PRE_AUTHORIZED",
    "paymentResponse": {
        "type": "APM",
        "apmName": "paypal",
        "name": "John Smith",
        "billingAddress": {
            "address1": "address1", 
            "postalCode": "postCode", 
            "city": "city", 
            "countryCode": "GB"
        },
        "shopperCountryCode": "GB"
    },
    "shopperLanguageCode": "en",
    "deliveryAddress": {
        "firstName": "John",
        "lastName": "Smith",
        "address1": "address1",
        "postalCode": "postCode",
        "city": "city",
        "countryCode": "GB",
        "telephoneNumber": "02079460761"
    },
    "shopperEmailAddress": "email address",
    "successUrl": "https://www.yourwebsite.co.uk/success?orderCode=worldpay-order-code",
    "pendingUrl": "https://www.yourwebsite.co.uk/pending?orderCode=worldpay-order-code",
    "failureUrl": "https://www.yourwebsite.co.uk/failure?orderCode=worldpay-order-code",
    "cancelUrl": "https://www.yourwebsite.co.uk/cancel?orderCode=worldpay-order-code",
    "redirectURL": "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=EC-4TS47089HV127380E",
    "environment": "LIVE"
}

Orders using non-card payment methods e.g. PayPal are collectively known as World Payment Methods, also known as Alternative Payment Methods. Creating a new order is performed through a POST on the Order API, in the same manner as for card orders. A WPM order is created using a WPM token, which the WorldPay.js library added to your checkout form. This token represents the customer's chosen payment method which WorldPay.js stored on our server.

Some Payment Providers require additional shopper information such as the delivery address and telephone number, and will reject orders which miss these details.

All WPMs require provision of the shopper's nominated country, this is specified in the shopperCountryCode attribute.

The following fields are recommended to improve risk checking:

name billingAddress deliveryAddress shopperEmailAddress shopperIpAddress shopperSessionId Other optional fields include:

customerOrderCode: code under which this order is known in your systems settlementCurrency: the currency you want to be paid in (which has to be enabled in your currency settings)