Create a Payment
Once you have acquired a token from the checkout page, you can now create a payment. We allow you to perform two types of payments – a regular, and split payment.
If you already have a MID you prefer to use with a different processor, please contact your account manager so it can be configured.
Before you are able to create a payment, you need to generate an authorization token. See Generating a token.
Regular Payment
Regular payment means the paid amount is not split and is completely sent to the specified merchant.
The request is made to the Create Payments endpoint. To authorize it, its headers must contain the generated appToken and the apiKey that we provided you. For this type of payment, these three parameters of the request body must be configured as follows:
- paymentType: Must be set to tokenv3 to specify this is a regular payment.
- merchantId: This is where you input the MID (Merchant ID).
- tokenId: This is where you input the credit card token captured by our iFrame
See the JSON request body example below.
POST: https://beta.digitzsapi.com/v3/payments
Headers:
Authorization: Bearer {token from Step 1: Generate an Authentication token}
x-api-key: {{ your api key }}
Body:
{
"data": {
"type": "payments",
"attributes": {
"paymentType": "tokenv3",
"merchantId": "{{merchantId}}",
"miscData": "{\"originIp\":\"127.0.0.1\",\"customerIp\":\"127.0.0.1\",\"rawData\":\"Lorem ipsum\"}",
"customer": {
"firstname": "Dominic",
"lastname": "Go",
"email": "dom@digitzs.com"
},
"token": {
"tokenId": "{{tokenExToken}}",
"holder": "Tommy",
"expiry": "0229",
"useAVS": true
},
"transaction": {
"amount": "001",
"currency": "USD",
"invoice": "PAYMENT-TOKEN-7"
},
"billingAddress": {
"line1": "21 Jump Street",
"line2": "Suite 007",
"city": "Los Angeles",
"state": "CA",
"zip": "832044716",
"country": "USA"
}
}
}
}
Split Payment
When part of the paid amount must be split and sent to a third party, you must make a split payment request.
The request is made to the Create Split Payments endpoint. Just like regular payments, the request headers must contain the generated appToken and the apiKey. For split payments, these three parameters of the request body must be configured as follows:
- paymentType: Must be set to tokenv3Split to specify this is a split payment.
- merchantId: This is where you input the MID (Merchant ID).
- tokenId: This is where you input the credit card token captured by our iFrame.
- split: This object is where you specify the third-party MID in themerchantId parameter and the amount to be split in the amount parameter.
See the JSON request body example below.
POST: https://beta.digitzsapi.com/v3/payments
Headers:
Authorization: Bearer {token from Step 1: Generate an Authentication token}
x-api-key: {{ your api key }}
Body:
{
"data": {
"type": "payments",
"attributes": {
"paymentType": "tokenv3Split",
"merchantId": "{{merchantId}}",
"miscData": "{\"originIp\":\"127.0.0.1\",\"customerIp\":\"127.0.0.1\",\"rawData\":\"Lorem ipsum\"}",
"customer": {
"firstname": "Dominic",
"lastname": "Go",
"email": "dom@digitzs.com"
},
"token": {
"tokenId": "{{tokenExToken}}",
"holder": "Tommy",
"expiry": "0229",
"useAVS": true
},
"transaction": {
"amount": "001",
"currency": "USD",
"invoice": "PAYMENT-TOKEN-7"
},
"billingAddress": {
"line1": "21 Jump Street",
"line2": "Suite 007",
"city": "Los Angeles",
"state": "CA",
"zip": "832044716",
"country": "USA"
}
}
}
}
Response:
{
"response": "3",
"responsetext": "Duplicate transaction REFID:124257436",
"authcode": "",
"transactionid": "",
"avsresponse": "",
"cvvresponse": "",
"orderid": "",
"type": "sale",
"response_code": "300"
}
Result codes:
100 Transaction was approved.
200 Transaction was declined by processor.
201 Do not honor.
202 Insufficient funds.
203 Over limit.
204 Transaction not allowed.
220 Incorrect payment information.
221 No such card issuer.
222 No card number on file with issuer.
223 Expired card.
224 Invalid expiration date.
225 Invalid card security code.
226 Invalid PIN.
240 Call issuer for further information.
250 Pick up card.
251 Lost card.
252 Stolen card.
253 Fraudulent card.
260 Declined with further instructions available. (See response text)
261 Declined-Stop all recurring payments.
262 Declined-Stop this recurring program.
263 Declined-Update cardholder data available.
264 Declined-Retry in a few days.
300 Transaction was rejected by gateway.
400 Transaction error returned by processor.
410 Invalid merchant configuration.
411 Merchant account is inactive.
420 Communication error.
421 Communication error with issuer.
430 Duplicate transaction at processor.
440 Processor format error.
441 Invalid transaction information.
460 Processor feature not available.
461 Unsupported card type.