Repeated payments with the gateway SERVER-TO-SERVER API
From a PCI DSS-compliant environment, you can directly integrate with the CardCorp gateway's SERVER-TO-SERVER API. Learn how to make repeated payments for instalments, subscriptions, or metered orders.
If you will use a card that was previously saved in the CardCorp gateway, see the separate instructions to create a one-click checkout.
1. Create the payment request
Use a POST
request to the payments
endpoint in the payment gateway for instalments, subscriptions, or metered orders.
curl https://eu-test.oppwa.com/v1/payments \
-d "entityId={channelId}" \
-d "amount=20.00" \
-d "currency=EUR" \
-d "paymentType=DB" \
-d "merchantTransactionId=P223" \
-d "paymentBrand=MASTER" \
-d "card.number=5200000000000049" \
-d "card.holder=Joe Smith" \
-d "card.expiryMonth=05" \
-d "card.expiryYear=2030" \
-d "billing.street1=Calle Principal 123" \
-d "billing.city=Barcelona" \
-d "billing.country=ES" \
-d "billing.postcode=08123" \
-d "[email protected]" \
-d "customer.ip=2001:8a0:7f4b:1b00:dd4e:2bf6:1fb8:56af" \
-d "customer.merchantCustomerId=CUST01" \
-d "testMode=EXTERNAL" \
-d "standingInstruction.type=INSTALLMENT" \
-d "standingInstruction.mode=REPEATED" \
-d "standingInstruction.source=MIT" \
-d "standingInstruction.initialTransactionId={CardholderInitiatedTransactionID}" \
-H "Authorization: Bearer {auth_token}"
curl https://eu-test.oppwa.com/v1/payments \
-d "entityId={channelId}" \
-d "amount=20.00" \
-d "currency=EUR" \
-d "paymentType=DB" \
-d "merchantTransactionId=P223" \
-d "paymentBrand=MASTER" \
-d "card.number=5200000000000049" \
-d "card.holder=Joe Smith" \
-d "card.expiryMonth=05" \
-d "card.expiryYear=2030" \
-d "billing.street1=Calle Principal 123" \
-d "billing.city=Barcelona" \
-d "billing.country=ES" \
-d "billing.postcode=08123" \
-d "[email protected]" \
-d "customer.ip=2001:8a0:7f4b:1b00:dd4e:2bf6:1fb8:56af" \
-d "customer.merchantCustomerId=CUST01" \
-d "testMode=EXTERNAL" \
-d "standingInstruction.type=RECURRING"\
-d "standingInstruction.mode=REPEATED" \
-d "standingInstruction.source=MIT"\
-d "standingInstruction.recurringType=SUBSCRIPTION"\
-d "standingInstruction.initialtransactionId={CardholderInitiatedTransactionID}"\
-H "Authorization: Bearer {auth_token}"
curl https://eu-test.oppwa.com/v1/payments \
-d "entityId={channelId}" \
-d "amount=20.00" \
-d "currency=EUR" \
-d "paymentType=DB" \
-d "merchantTransactionId=P223" \
-d "paymentBrand=MASTER" \
-d "card.number=5200000000000049" \
-d "card.holder=Joe Smith" \
-d "card.expiryMonth=05" \
-d "card.expiryYear=2030" \
-d "billing.street1=Calle Principal 123" \
-d "billing.city=Barcelona" \
-d "billing.country=ES" \
-d "billing.postcode=08123" \
-d "[email protected]" \
-d "customer.ip=2001:8a0:7f4b:1b00:dd4e:2bf6:1fb8:56af" \
-d "customer.merchantCustomerId=CUST01" \
-d "testMode=EXTERNAL" \
-d "standingInstruction.type=UNSCHEDULED" \
-d "standingInstruction.mode=REPEATED" \
-d "standingInstruction.source=MIT" \
-d "standingInstruction.recurringType=STANDING_ORDER" \
-d "standingInstruction.initialtransactionId={CardholderInitiatedTransactionID}" \
-H "Authorization: Bearer {auth_token}"
Replace the example values with your values and replace the {channelId}
and {auth_token}
with your API credentials.
Here are some notes about the parameters in the above request.
When you are testing your integration, you can use these parameters.
Parameters | Notes |
---|---|
testMode | This parameter is for the test environment only. Set to EXTERNAL to send the transaction to the acquirer's test environment. Set to INTERNAL to process the transaction in the gateway only. |
Test in the gateway playground
For the gateway documentation and playground for this request, go to Gateway documentation for server-to-server, and in the Use cases section, select Synchronous payment.
In the gateway playground, you can use the following test data for repeated payments for instalments, subscriptions, and metered payments.
entityId=(Channel ID)
amount=40.00
currency=EUR
paymentType=DB
merchantTransactionId=P123
paymentBrand=VISA
card.number=4711100000000000
card.holder=Joe Smith
card.expiryMonth=05
card.expiryYear=2030
billing.street1=Ave. Diagonal 611
billing.city=Barcelona
billing.country=ES
billing.postcode=08028
[email protected]
customer.ip=2001:8a0:7f4b:1b00:dd4e:2bf6:1fb8:56af
standingInstruction.type=INSTALLMENT
standingInstruction.mode=REPEATED
standingInstruction.source=MIT
standingInstruction.initialTransactionId={CardholderInitiatedTransactionID}
testMode=EXTERNAL
entityId=(Channel ID)
amount=40.00
currency=EUR
paymentType=DB
merchantTransactionId=P123
paymentBrand=VISA
card.number=4711100000000000
card.holder=Joe Smith
card.expiryMonth=05
card.expiryYear=2030
billing.street1=Ave. Diagonal 611
billing.city=Barcelona
billing.country=ES
billing.postcode=08028
[email protected]
customer.ip=2001:8a0:7f4b:1b00:dd4e:2bf6:1fb8:56af
standingInstruction.type=RECURRING
standingInstruction.mode=REPEATED
standingInstruction.source=MIT
standingInstruction.recurringType=SUBSCRIPTION
standingInstruction.initialTransactionId={CardholderInitiatedTransactionID}
testMode=EXTERNAL
entityId=(Channel ID)
amount=40.00
currency=EUR
paymentType=DB
merchantTransactionId=P123
paymentBrand=VISA
card.number=4711100000000000
card.holder=Joe Smith
card.expiryMonth=05
card.expiryYear=2030
billing.street1=Ave. Diagonal 611
billing.city=Barcelona
billing.country=ES
billing.postcode=08028
[email protected]
customer.ip=2001:8a0:7f4b:1b00:dd4e:2bf6:1fb8:56af
standingInstruction.type=UNSCHEDULED
standingInstruction.mode=REPEATED
standingInstruction.source=MIT
standingInstruction.recurringType=STANDING_ORDER
standingInstruction.initialTransactionId={CardholderInitiatedTransactionID}
testMode=EXTERNAL
For a saved card, you can use the following data and see Gateway documentation one-click payment. For a repeated payment, use the registration endpoint at https://eu-test.oppwa.com/v1/registrations/{id}/payments
. Replace {id}
with the registrationId
and do not submit any card or customer data. Also, send the 3DS data from the original request.
entityId={channelId}
paymentBrand=VISA
paymentType=DB
amount=18.99
currency=EUR
customer.givenName=Joe
customer.surname=Smith
customer.merchantCustomerId=CUST01
threeDSecure.eci=05
threeDSecure.authenticationStatus=Y
threeDSecure.version=2.2.0
threeDSecure.dsTransactionId=c75f23af-9454-43f6-ba17-130ed529507e
threeDSecure.acsTransactionId=2c42c553-176f-4f08-af6c-f9364ecbd0e8
threeDSecure.verificationId=MTIzNDU2Nzg5MDEyMzQ1Njc4OTA=
threeDSecure.amount=19.99
threeDSecure.currency=EUR
threeDSecure.flow=challenge
testMode=EXTERNAL
standingInstruction.type=RECURRING
standingInstruction.mode=INITIAL
standingInstruction.source=CIT
Example response
Here is an example of the response to a request for a repeated payment.
{
"id":"8ac7a49f917803dd01917ad7f007584a",
"paymentType":"DB",
"paymentBrand":"VISA",
"merchantTransactionId":"P123",
"result":{
"code":"800.900.300",
"description":"invalid authentication information"
},
"card":{
"bin":"471110",
"last4Digits":"0000",
"holder":"Joe Smith",
"expiryMonth":"05",
"expiryYear":"2030"
},
"customer":{
"email":"[email protected]",
"ip":"2001:8a0:7f4b:1b00:dd4e:2bf6:1fb8:56af"
},
"billing":{
"street1":"Ave. Diagonal 611",
"city":"Barcelona",
"postcode":"08028",
"country":"ES"
},
"buildNumber":"58e6de7e1e6a0b42807a3a291ebd50fa46ba3ff9@2024-08-19 00:42:32 +0000",
"timestamp":"2024-08-22 16:07:37+0000",
"ndc":"8ac7a4c890fc748b0190fe6ad56b0241_7092eeec12c549b28b38ff3962fceb9f",
"standingInstruction":{
"source":"MIT",
"type":"INSTALLMENT",
"mode":"REPEATED",
"initialTransactionId":"822164300567930"
},
"source":"OPP",
"paymentMethod":"CC",
"shortId":"5901.9773.1623"
}
From this response, save the payment id
to get the payment status and manage the payment to capture a pre-authorisation, refund, or reverse a pre-authorisation from the payments endpoint with the back-office API. See Backoffice API operations.
To interpret the payment response, see Transaction results.
2. Get the payment status
Get the payment status from the payments endpoint with a GET
request in the following format.
curl -G https://eu-test.oppwa.com/v1/payments/{id} \
-d "entityId={channelId}" \
-H "Authorization: Bearer {auth_token}"
The gateway documentation and playground for this request are at gateway documentation for asynchronous server-to-server under 3. Get the payment status.