- Home
- All APIs
- Worldpay Online Payments Guide
- Direct Payments
Direct Payments
This guide explains how to implement Direct payments.
We recommend this method if you are already SAQ-D PCI compliant, or are willing to achieve
Payment Details
For Direct payments, the first time your customer makes a payment you must obtain their payment details and store them securely in your systems.
The Direct payment should otherwise be completed in the same way as a token payment, except that the paymentMethod
details are set in the order request directly.
Below are code examples of how to make a Direct card payment from your server:
Copied!
curl https://api.worldpay.com/v1/orders
-H "Authorization: your-test-service-key"
-H "Content-type: application/json"
-X POST
-d '{
"paymentMethod":{
"type":"Card",
"name":"cardholder-name",
"expiryMonth":"2",
"expiryYear":"2020",
"cardNumber":"4444333322221111",
"cvc":"123",
"issueNumber":"1"
},
"orderType": "ECOM",
"orderDescription": "your-order-description",
"amount": 500,
"currencyCode": "GBP" }'
The response to this call will include the following JSON object:
{
"orderCode": "worldpay-generated-order-code",
"token": "worldpay-generated-order-token",
"orderDescription": "your-order-description",
"amount": 500,
"currencyCode": "GBP",
"paymentStatus": "SUCCESS",
"paymentResponse":
{
"type": "ObfuscatedCard",
"name": "name-of-shopper",
"expiryMonth": "2",
"expiryYear": "2020",
"cardType": "VISA",
"maskedCardNumber": "**** **** **** 1111" },
"environment": "TEST"
}
curl https://api.worldpay.com/v1/orders -H "Authorization: your-test-service-key" -H "Content-type: application/json" -X POST -d '{ "paymentMethod":{ "type":"Card", "name":"cardholder-name", "expiryMonth":"2", "expiryYear":"2020", "cardNumber":"4444333322221111", "cvc":"123", "issueNumber":"1" }, "orderType": "ECOM", "orderDescription": "your-order-description", "amount": 500, "currencyCode": "GBP" }' The response to this call will include the following JSON object: { "orderCode": "worldpay-generated-order-code", "token": "worldpay-generated-order-token", "orderDescription": "your-order-description", "amount": 500, "currencyCode": "GBP", "paymentStatus": "SUCCESS", "paymentResponse": { "type": "ObfuscatedCard", "name": "name-of-shopper", "expiryMonth": "2", "expiryYear": "2020", "cardType": "VISA", "maskedCardNumber": "**** **** **** 1111" }, "environment": "TEST" }
Similarly, we can include APM payment details directly in an order request, without obtaining a token.
Copied!
curl https://api.worldpay.com/v1/orders
-H "Authorization: your-test-service-key"
-H "Content-type: application/json"
-X POST
-d '{
"paymentMethod":{
"type":"APM",
"name": "name-of-shopper",
"apmName" : "paypal"
}, "orderDescription": "your-order-description",
"amount": 500,
"currencyCode": "GBP" }'
The response to this call will include the following JSON object:
{
"orderCode": "worldpay-generated-order-code",
"token": "worldpay-generated-order-token",
"orderDescription": "your-order-description",
"amount": 500,
"currencyCode": "GBP",
"paymentStatus": "SUCCESS",
"paymentResponse":
{
"type": "APM",
"name": "name-of-shopper",
"apmName": "paypal"
},
"successUrl": "https://www.merchant.co.uk/success?orderCode=worldpay-generated-order-code",
"pendingUrl": "https://www.merchant.co.uk/pending?orderCode=worldpay-generated-order-code",
"failureUrl": "https://www.merchant.co.uk/failure?orderCode=worldpay-generated-order-code",
"cancelUrl": "https://www.merchant.co.uk/cancel?orderCode=worldpay-generated-order-code",
"redirectURL": "https://www.paypal-test.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=EC-8V710922Y081262Y"
"environment": "TEST"
}
curl https://api.worldpay.com/v1/orders -H "Authorization: your-test-service-key" -H "Content-type: application/json" -X POST -d '{ "paymentMethod":{ "type":"APM", "name": "name-of-shopper", "apmName" : "paypal" },
"orderDescription": "your-order-description", "amount": 500, "currencyCode": "GBP" }' The response to this call will include the following JSON object: { "orderCode": "worldpay-generated-order-code", "token": "worldpay-generated-order-token", "orderDescription": "your-order-description", "amount": 500, "currencyCode": "GBP", "paymentStatus": "SUCCESS", "paymentResponse": { "type": "APM", "name": "name-of-shopper", "apmName": "paypal" }, "successUrl": "https://www.merchant.co.uk/success?orderCode=worldpay-generated-order-code", "pendingUrl": "https://www.merchant.co.uk/pending?orderCode=worldpay-generated-order-code", "failureUrl": "https://www.merchant.co.uk/failure?orderCode=worldpay-generated-order-code", "cancelUrl": "https://www.merchant.co.uk/cancel?orderCode=worldpay-generated-order-code", "redirectURL": "https://www.paypal-test.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=EC-8V710922Y081262Y" "environment": "TEST" }
"orderDescription": "your-order-description", "amount": 500, "currencyCode": "GBP" }' The response to this call will include the following JSON object: { "orderCode": "worldpay-generated-order-code", "token": "worldpay-generated-order-token", "orderDescription": "your-order-description", "amount": 500, "currencyCode": "GBP", "paymentStatus": "SUCCESS", "paymentResponse": { "type": "APM", "name": "name-of-shopper", "apmName": "paypal" }, "successUrl": "https://www.merchant.co.uk/success?orderCode=worldpay-generated-order-code", "pendingUrl": "https://www.merchant.co.uk/pending?orderCode=worldpay-generated-order-code", "failureUrl": "https://www.merchant.co.uk/failure?orderCode=worldpay-generated-order-code", "cancelUrl": "https://www.merchant.co.uk/cancel?orderCode=worldpay-generated-order-code", "redirectURL": "https://www.paypal-test.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=EC-8V710922Y081262Y" "environment": "TEST" }
Suggested next steps: