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 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.

ParametersNotes
testModeThis 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.

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"
}

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.

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.