Worldpay REST Gateway Guide
Quick Start
New to integrating Worldpay Rest with Spreedly? Here's your setup guide:
- Retrieve your Worldpay Rest credentials:
- Contact the Worldpay support team to obtain your Worldpay Access credentials: username, password, and entity.
- For gateway-specific 3DS2 on Worldpay REST, no additional credentials are required beyond the above — authentication requests use the same username/password/entity as payment requests.
- Get familiar with the Spreedly API:
- Review Spreedly API basics.
- Review Gateways, Payment Methods, and Transactions.
- Add an Worldpay Rest gateway to Spreedly in sandbox mode.
Review this documentation to understand more about how to test transactions.
| Additional notes |
|---|
order_id is used to populate the request's transactionReference when provided. If order_id is omitted, Spreedly generates a transaction reference automatically. |
Adding a Worldpay Gateway
Required Credentials
username: Your Worldpay Access username.password: Your Worldpay Access password.entity: Your Worldpay Access entity identifier.
Request
curl https://core.spreedly.com/v1/gateways.xml \
-u 'C7cRfNJGODKh4Iu5Ox3PToKjniY:4UIuWybmdythfNGPqAqyQnYha6s451ri0fYAo4p3drZUi7q2Jf4b7HKg8etDtoKJ' \
-H 'Content-Type: application/xml' \
-d '<gateway>
<gateway_type>worldpay_rest</gateway_type>
<username>Your Worldpay Access Username</username>
<password>Your Worldpay Access Password</password>
<entity>Your Worldpay Access Entity</entity>
</gateway>'Response
<gateway>
<token>IFEnzFllMG2bcTo7fWmVe6xHxyz</token>
<gateway_type>worldpay_rest</gateway_type>
<name>Worldpay REST</name>
<description nil="true"/>
<merchant_profile_key nil="true"/>
<username>Your Worldpay Access Username</username>
<entity>Your Worldpay Access Entity</entity>
<characteristics>
<supports_purchase type="boolean">true</supports_purchase>
<supports_authorize type="boolean">true</supports_authorize>
<supports_capture type="boolean">true</supports_capture>
<supports_credit type="boolean">true</supports_credit>
<supports_general_credit type="boolean">true</supports_general_credit>
<supports_void type="boolean">true</supports_void>
<supports_adjust type="boolean">false</supports_adjust>
<supports_verify type="boolean">true</supports_verify>
<supports_reference_purchase type="boolean">false</supports_reference_purchase>
<supports_purchase_via_preauthorization type="boolean">false</supports_purchase_via_preauthorization>
<supports_offsite_purchase type="boolean">false</supports_offsite_purchase>
<supports_offsite_authorize type="boolean">false</supports_offsite_authorize>
<supports_3dsecure_2_mpi_purchase type="boolean">true</supports_3dsecure_2_mpi_purchase>
<supports_3dsecure_2_mpi_authorize type="boolean">true</supports_3dsecure_2_mpi_authorize>
<supports_store type="boolean">true</supports_store>
<supports_remove type="boolean">true</supports_remove>
<supports_fraud_review type="boolean">false</supports_fraud_review>
<supports_network_tokenization type="boolean">true</supports_network_tokenization>
<supports_3dsecure_2_purchase type="boolean">true</supports_3dsecure_2_purchase>
<supports_3dsecure_2_authorize type="boolean">true</supports_3dsecure_2_authorize>
<supports_partial_capture type="boolean">true</supports_partial_capture>
<supports_partial_refund type="boolean">true</supports_partial_refund>
</characteristics>
<credentials>
<credential>
<name>username</name>
<value>Your Worldpay Access Username</value>
</credential>
<credential>
<name>entity</name>
<value>Your Worldpay Access Entity</value>
</credential>
</credentials>
<gateway_settings>
</gateway_settings>
<gateway_specific_fields>
<gateway_specific_field>channel</gateway_specific_field>
<gateway_specific_field>reference</gateway_specific_field>
<gateway_specific_field>idempotency_key</gateway_specific_field>
<gateway_specific_field>namespace</gateway_specific_field>
<gateway_specific_field>stored_credential_usage</gateway_specific_field>
<gateway_specific_field>stored_credential_initiated_reason</gateway_specific_field>
<gateway_specific_field>stored_credential_transaction_id</gateway_specific_field>
<gateway_specific_field>level_2_data</gateway_specific_field>
<gateway_specific_field>level_3_data</gateway_specific_field>
<gateway_specific_field>instalments</gateway_specific_field>
<gateway_specific_field>installment_type</gateway_specific_field>
<gateway_specific_field>statement_narrative</gateway_specific_field>
<gateway_specific_field>statement_narrative_line2</gateway_specific_field>
<gateway_specific_field>accept_partial_amount</gateway_specific_field>
<gateway_specific_field>partial_authorisation</gateway_specific_field>
<gateway_specific_field>pf_id</gateway_specific_field>
<gateway_specific_field>iso_id</gateway_specific_field>
<gateway_specific_field>sub_name</gateway_specific_field>
<gateway_specific_field>sub_id</gateway_specific_field>
<gateway_specific_field>sub_street</gateway_specific_field>
<gateway_specific_field>sub_city</gateway_specific_field>
<gateway_specific_field>sub_state</gateway_specific_field>
<gateway_specific_field>sub_country_code</gateway_specific_field>
<gateway_specific_field>sub_postal_code</gateway_specific_field>
<gateway_specific_field>sub_tax_id</gateway_specific_field>
<gateway_specific_field>sub_email</gateway_specific_field>
<gateway_specific_field>sub_telephone</gateway_specific_field>
<gateway_specific_field>exemption_type</gateway_specific_field>
<gateway_specific_field>exemption_placement</gateway_specific_field>
</gateway_specific_fields>
<payment_methods>
<payment_method>credit_card</payment_method>
<payment_method>third_party_token</payment_method>
<payment_method>apple_pay</payment_method>
<payment_method>third_party_apple_pay</payment_method>
<payment_method>google_pay</payment_method>
<payment_method>third_party_google_pay</payment_method>
</payment_methods>
<state>retained</state>
<redacted type="boolean">false</redacted>
<sandbox type="boolean">false</sandbox>
<created_at type="dateTime">2021-12-06T22:40:37Z</created_at>
<updated_at type="dateTime">2021-12-06T22:40:37Z</updated_at>
</gateway>Purchase
curl https://core.spreedly.com/v1/gateways/[gateway_token]/purchase.xml \
-u 'EnvironmentKey:AccessSecret' \
-H 'Content-Type: application/xml' \
-d '<transaction>
<payment_method_token>payment_method_token</payment_method_token>
<amount>1000</amount>
<currency_code>GBP</currency_code>
</transaction>'Stored Credentials
Worldpay REST supports Spreedly's native stored credential fields on Purchase and Authorize requests:
stored_credential_initiatorstored_credential_reason_type
Spreedly maps these to Worldpay Access'scustomerAgreementelement. Customer-initiated transactions (initiator: cardholder) are sent to Worldpay'scustomerInitiatedTransactionsendpoint; merchant-initiated transactions (initiator: merchant) are sent to Worldpay'smerchantInitiatedTransactionsendpoint.
First / credential-on-file setup (CIT)
reason_type | initiator | Worldpay customerAgreement.type | storedCardUsage |
|---|---|---|---|
installment | cardholder | installment | first |
recurring | cardholder | subscription | first |
unscheduled | cardholder | cardOnFile | first |
Subsequent use — customer-initiated (CIT)
Only cardOnFile can be combined with a subsequent stored-card transaction on the customer-initiated endpoint, regardless of the original reason_type.
reason_type | initiator | Worldpay customerAgreement.type | storedCardUsage |
|---|---|---|---|
installment | cardholder | cardOnFile | subsequent |
recurring | cardholder | cardOnFile | subsequent |
unscheduled | cardholder | cardOnFile | subsequent |
Subsequent use — merchant-initiated (MIT)
Merchant-initiated requests omit storedCardUsage and the card CVC, and include customerAgreement.schemeReference (the original network/scheme transaction ID) when one is available.
reason_type | initiator | Worldpay customerAgreement.type |
|---|---|---|
installment | merchant | installment |
recurring | merchant | subscription |
unscheduled | merchant | unscheduled |
Learn more about how spreedly enables use of stored credentials by reviewing our Stored credentials Guide
Gateway Specific Fields
Common Fields
| Field Name | Type | Required | Description | Example |
|---|---|---|---|---|
channel | String | No | Transaction channel. Defaults to moto when metadata.manual_entry is set (or three_ds_exemption_type is moto), otherwise ecom. Not sent on MIT requests. | moto |
reference | String | No | Merchant reference, used on partial capture/refund follow-up requests only. | spreedly-ref-1 |
idempotency_key | String | No | Sent as the Idempotency-Key header to prevent duplicate requests. | 11111 |
statement_narrative | String | No | Cardholder statement narrative, line 1 (max 24 chars). Falls back to description, then order_id, then Spreedly. | MERCHANT NARRATIVE |
statement_narrative_line2 | String | No | Cardholder statement narrative, line 2 (max 24 chars). | ORDER 1234 |
instalments | String | No | Number of instalments for a instalment plan. | 6 |
installment_type | String | No | Overrides the Worldpay customerAgreement.installmentType value (e.g. latinAmerica, merchant). | latinAmerica |
accept_partial_amount / partial_authorisation | Boolean | No | Enables partial authorization on an auth-only transaction. Either field name may be used. | true |
level_2_data | Object | No | Level 2 commercial card data. See Level 2 / Level 3 data below. | See below |
level_3_data | Object | No | Level 3 line-item commercial card data. See Level 2 / Level 3 data below. | See below |
3DS Fields
| Field Name | Type | Required | Description | Example |
|---|---|---|---|---|
exemption_type | String | No | SCA exemption type (LV → lowValue, LR → lowRisk; other values passed through as-is). | LV |
exemption_placement | String | No | Where the exemption is requested (authorization or authentication). Defaults to authorization | AUTHENTICATION |
Browser/device data used during gateway-specific 3DS2 (accept header, user agent, browser language, Java/JavaScript support, color depth, screen size, time zone, IP address, challenge window size) is supplied through Spreedly's standard 3DS2 browser_info options rather than a Worldpay REST gateway specific field — see 3DS2 gateway-specific below.
Store credential fields
| Field Name | Type | Required | Description | Example |
|---|---|---|---|---|
stored_credential_usage | String | No | FIRST marks the initial stored-credential transaction; any other value (e.g. USED) marks a subsequent one and routes to the merchant-initiated endpoint. | USED |
stored_credential_initiated_reason | String | No | Worldpay agreement type (e.g. installment, subscription, cardOnFile, unscheduled). Defaults to cardOnFile on first use if omitted. | subscription |
stored_credential_transaction_id | String | No | Original scheme/network transaction ID for subsequent transactions. | 39270fd70be13aab55f84e28be45cad3 |
Refund/Void fields
Worldpay REST does not expose separate refund- or void-only gateway specific fields. idempotency_key (documented under Common Fields above) applies to void and refund requests the same as any other request; reference applies only when capturing or refunding a partial amount.
Store fields
| Field Name | Type | Required | Description | Example |
|---|---|---|---|---|
namespace | String | No | Optional Worldpay Access token namespace for the store request. | my-namespace |
The stored token's description is taken from the transaction's description attribute (or the statement narrative fields, if set) when supplied.
Sub-merchant data
| Field Name | Type | Required | Description | Example |
|---|---|---|---|---|
pf_id | String | Yes (to enable) | Payment facilitator scheme ID. The sub-merchant block is only sent when this is present. | PF123 |
iso_id | String | No | Independent Sales Organisation ID. | ISO456 |
sub_name | String | No | Sub-merchant name. | Example Shop |
sub_id | String | No | Sub-merchant reference. | 1234567 |
sub_email | String | No | Sub-merchant email address. | [email protected] |
sub_telephone | String | No | Sub-merchant phone number. | +13125550100 |
sub_tax_id | String | No | Sub-merchant tax reference. | 987-65-4321 |
sub_street | String | No | Sub-merchant street address. | 123 Street |
sub_city | String | No | Sub-merchant city. | San Francisco |
sub_state | String | No | Sub-merchant state/province. | CA |
sub_country_code | String | No | Sub-merchant ISO country code. | US |
sub_postal_code | String | No | Sub-merchant postal code. | 94101 |
Level 2 / Level 3 data
The level_2_data and level_3_data gateway specific fields are merged together and mapped onto the Worldpay Access order object.
| Key | Worldpay Access field | Description |
|---|---|---|
card_acceptor_tax_id | merchant.taxReference | Merchant tax ID. |
customer_reference | customer.reference | Customer reference. |
invoice_reference_number | order.invoiceReference | Invoice reference. |
tax_amount / sales_tax | order.salesTax | Sales tax amount, in minor currency units. |
discount_amount | order.discountAmount | Order-level discount amount. |
shipping_amount | order.shippingAmount | Shipping amount. |
duty_amount | order.dutyAmount | Duty amount. |
ship_from_postal_code | shipping.sender.address.postalCode | Ship-from postal code. |
destination_postal_code | shipping.recipient.address.postalCode | Ship-to postal code. |
destination_country_code | shipping.recipient.address.countryCode | Ship-to country code. |
order_date | order.orderDate ({day, month, year}) | Order date. day may also be supplied as day_of_month. |
tax_exempt | order.taxExempt | Explicit tax-exempt flag. When omitted, inferred as true when the sales tax amount is zero. |
items / line_items / item | order.items[] | Array of Level 3 line items — see below. |
Each entry in items supports:
| Key | Worldpay Access field |
|---|---|
product_code | productCode |
commodity_code | commodityCode |
name / description | name |
quantity | quantity |
unit_cost | unitCost |
unit_of_measure | unitOfMeasure (defaults to each) |
item_total / total_amount_no_tax | totalAmountNoTax |
tax_amount / total_tax_amount | totalTaxAmount |
item_total_with_tax / total_amount | totalAmount |
item_discount_amount / total_discount_amount / discount_amount | totalDiscountAmount |
Network Tokenization
Worldpay REST accepts network-tokenized cards (payment methods provided to Spreedly as a network token) in addition to plain cards. The paymentInstrument.type sent to Worldpay depends on the token's source:
| Payment method | Worldpay paymentInstrument.type |
|---|---|
| Generic network token | card/networkToken |
| Apple Pay network token (decrypted) | card/networkToken+applepay |
| Google Pay network token (decrypted) | card/networkToken+googlepay |
| Apple Pay encrypted wallet payload | card/wallet+applepay |
| Google Pay encrypted wallet payload | card/wallet+googlepay |
For a network token, tokenNumber carries the token PAN and expiryDate the token's expiration; cardHolderName is included when present. No cvc is sent for network tokens.
When the payment method carries a payment cryptogram and/or ECI value, Spreedly sends them as authentication.networkToken.{cryptogram, eci} on customer-initiated requests. This, like the rest of the authentication object, is omitted on merchant-initiated (MIT) requests.
3DS2 gateway-specific
Spreedly supports gateway specific 3DS2 via Worldpay REST (Worldpay Access). Authentication requests are made using the same username/password/entity credentials as payment requests — no separate HMAC secret, Issuer ID, or Org Unit ID is required.
3DS2 exemptions
When conducting 3DS2 transactions you may use the gateway specific fields exemption_type and exemption_placement (documented under 3DS Fields above). See Worldpay's SCA exemptions documentation for detailed descriptions of each exemption type.
Third-party 3DS2 auth data
Spreedly will automatically handle the field mapping for sending third-party 3DS2 authentication data to Worldpay REST. For more information about how to use this feature, see the 3DS2 third-party authentication guide. Spreedly fields map to the relevant Worldpay Access fields as follows:
| Spreedly field | Worldpay Access field |
|---|---|
three_ds_version | version |
ecommerce_indicator | eci |
authentication_value | authenticationValue |
directory_server_transaction_id | transactionId |
General credit operation setup
Worldpay REST general credit (payout) transactions are sent to Worldpay Access's disbursement endpoint using a plain card payout instrument.
Store operation setup
Worldpay REST stores payment methods through Worldpay Access's tokens endpoint and returns a token that can be reused as the payment method on later Purchase/Authorize/Verify requests. Optionally scope the token to a namespace using the namespace gateway specific field (documented under Store fields above). If Worldpay returns an existing token for the same card, Spreedly still treats the store as successful and returns the existing token. Removing a stored payment method calls Worldpay's token deletion endpoint.
Gateway specific response fields
A response from the Worldpay REST gateway may contain some of the following fields, returned under gateway_specific_response_fields:
<transaction>
<token>LgpTNGjsWQs9DwdxcbreUVz0xyz</token>
<transaction_type>Authorization</transaction_type>
<gateway_specific_response_fields>
<worldpay_rest>
<outcome>authorized</outcome>
<payment_id>a1b2c3d4-e5f6-7890-aaaa-bbbbccccdddd</payment_id>
<transaction_reference>spreedly-abc123</transaction_reference>
<scheme>
<reference>123456789012345</reference>
</scheme>
<amounts>
<totalAuthorized>1000</totalAuthorized>
</amounts>
<authorised_amount>1000</authorised_amount>
</worldpay_rest>
</gateway_specific_response_fields>
</transaction>Partial authorization
In order to enable partial authorization, set the gateway specific field accept_partial_amount (or partial_authorisation) to true on an Authorize transaction. Partial authorization is only applied when the transaction does not auto-settle, so it does not apply to Purchase.
If a partial amount is authorized, the transaction still succeeds normally (state: "succeeded"). You can detect a partial approval from the gateway specific response fields:
authorised_amount— the amount (in minor currency units) that was actually authorized, from Worldpay'samounts.totalAuthorized.partial_authorization— Worldpay'samounts.partialAuthorizationdetail.
When enabling partial authorization, keep track of the authorized amount and specify that value as theamounton your follow-up Capture request to Spreedly, should you choose to capture the partial amount.
Syncing transactions
Spreedly supports updating the status of transactions that have been initiated at the Worldpay REST gateway. Spreedly queries Worldpay's Payment Queries API using the stored payment_id (Worldpay paymentId), falling back to the transaction's transactionReference (Spreedly order_id) when no payment ID was captured for the transaction. Because Payment Queries data is aggregated asynchronously by Worldpay, a "payment not found" result is treated as inconclusive rather than a definitive failure.
Additional resources
If you need support with this gateway, please contact Support at [email protected].
Worldpay Access documentation: https://docs.worldpay.com/access
API endpoint:
https://access.worldpay.com(Production)Test endpoint:
https://try.access.worldpay.com(Sandbox)
Updated about 7 hours ago

