- Home
- All APIs
- WPG guide
- The payment process
- Pay As Order (Recurring Payments)
Pay As Order (Recurring Payments)
How to integrate Pay As Order (information for legacy integrations).
Best practice: We strongly recommend using
Activating the service
To activate recurring payments, contact your Relationship Manager.
The process
There are two different XML requests involved:
- The first request - a standard payment request
- All subsequent requests - referencing the first request
Follow these steps:
- Activate the service and note your assigned merchant code. This additional merchant code is the one you'll use to send subsequent requests.
- For the initial payment, create a
Direct payment request orHosted payment request as normal, using your original merchant code. - Once this initial request has been successfully processed, create a subsequent request using the additional merchant code assigned in step 1.
Create the subsequent request
For all subsequent payment requests you must supply:
- The
<description>
- The
<amount>
details of the subsequent request (which can be different from the initial request) - The
<orderContent>
- The
<payAsOrder>
element, specifying the<orderCode>
and the<merchantCode>
from the original request - The
<amount>
details of the initial request (as child elements of<payAsOrder>
)
Copied!
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE paymentService PUBLIC "-//Worldpay//DTD Worldpay PaymentService v1//EN"
"http://dtd.worldpay.com/paymentService_v1.dtd">
<paymentService version="1.4" merchantCode="YOUR_MERCHANT_CODE_2"> <!--Enter the additional merchant code you've been assigned-->
<submit>
<order orderCode="YOUR_NEW_ORDER_CODE"> <!--Use a unique order code to differentiate-->
<description>YOUR DESCRIPTION</description> <!--Enter a description useful to you-->
<amount currencyCode="GBP" exponent="2" value="1399"/> <!--The amount, etc. of this subsequent request-->
<orderContent>
<![CDATA[]]>
</orderContent>
<payAsOrder orderCode="YOUR_ORDER_CODE" merchantCode="YOUR_MERCHANT_CODE"> <!--The order and merchant code from the first request-->
<amount value="5000" currencyCode="EUR" exponent="2"/> <!--The amount, etc. from the first request-->
</payAsOrder>
</order>
</submit>
</paymentService>
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE paymentService PUBLIC "-//Worldpay//DTD Worldpay PaymentService v1//EN" "http://dtd.worldpay.com/paymentService_v1.dtd"> <paymentService version="1.4" merchantCode="YOUR_MERCHANT_CODE_2"> <!--Enter the additional merchant code you've been assigned--> <submit> <order orderCode="YOUR_NEW_ORDER_CODE"> <!--Use a unique order code to differentiate--> <description>YOUR DESCRIPTION</description> <!--Enter a description useful to you--> <amount currencyCode="GBP" exponent="2" value="1399"/> <!--The amount, etc. of this subsequent request--> <orderContent> <![CDATA[]]> </orderContent> <payAsOrder orderCode="YOUR_ORDER_CODE" merchantCode="YOUR_MERCHANT_CODE"> <!--The order and merchant code from the first request--> <amount value="5000" currencyCode="EUR" exponent="2"/> <!--The amount, etc. from the first request--> </payAsOrder> </order> </submit> </paymentService>
Note: You can also supply the cvc in your subsequent requests. To do this, include it as an attribute of the <payAsOrder>
element: cvc="123". It will then be returned in the response message from us, as shown below.
Our reply to a subsequent request
Copied!
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE paymentService PUBLIC "-//Worldpay//DTD Worldpay PaymentService v1//EN"
"http://dtd.worldpay.com/paymentService_v1.dtd">
<paymentService version="1.4" merchantCode="YourMerchantCode2">
<reply>
<orderStatus orderCode="YourNewOrderCode">
<payment>
<paymentMethod>VISA-SSL</paymentMethod>
<amount value="1399" currencyCode-"EUR" exponent="2" debitCreditIndicator="credit"/>
<lastEvent>AUTHORISED</lastEvent>
<CVCResultCode description="A"> <!--Will only show if sent in a subsequent request-->
<balance accountType=IN_PROCESS_AUTHORISED">
<amount value="1399" currencyCode="EUR" exponent="2" debitCreditIndicator="credit"/>
</balance>
<cardNumber>4568********0015</cardNumber>
</payment>
</orderStatus>
</reply>
</paymentService>
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE paymentService PUBLIC "-//Worldpay//DTD Worldpay PaymentService v1//EN" "http://dtd.worldpay.com/paymentService_v1.dtd"> <paymentService version="1.4" merchantCode="YourMerchantCode2"> <reply> <orderStatus orderCode="YourNewOrderCode"> <payment> <paymentMethod>VISA-SSL</paymentMethod> <amount value="1399" currencyCode-"EUR" exponent="2" debitCreditIndicator="credit"/> <lastEvent>AUTHORISED</lastEvent> <CVCResultCode description="A"> <!--Will only show if sent in a subsequent request--> <balance accountType=IN_PROCESS_AUTHORISED"> <amount value="1399" currencyCode="EUR" exponent="2" debitCreditIndicator="credit"/> </balance> <cardNumber>4568********0015</cardNumber> </payment> </orderStatus> </reply> </paymentService>
Recurring payment error message
If your account hasn't been set up to allow recurring payments, you'll receive this error:
Copied!
<!DOCTYPE paymentService PUBLIC "-//WorldPay/DTD WorldPay PaymentService v1//EN"
"http://dtd.worldpay.com/paymentService_v1.dtd">
<paymentService merchantCode="YourMerchantCode" version="1.4">
<reply>
<orderStatus orderCode="YourOrderCode">
<error code="2"><![CDATA[Your contract does not allow split payment.]]></error>
</orderStatus>
</reply>
</paymentService>
<!DOCTYPE paymentService PUBLIC "-//WorldPay/DTD WorldPay PaymentService v1//EN" "http://dtd.worldpay.com/paymentService_v1.dtd"> <paymentService merchantCode="YourMerchantCode" version="1.4"> <reply> <orderStatus orderCode="YourOrderCode"> <error code="2"><![CDATA[Your contract does not allow split payment.]]></error> </orderStatus> </reply> </paymentService>