Using Payment Intents
The payment intent encapsulates details about the transaction, such as the amount to collect, the supported payment methods, the expiration time for the transaction, and whether the payment method is to be tokenized.
A payment intent allows you to collect and confirm information about a payment before capturing the funds from the customer's account. The payment intent encapsulates details about the transaction, such as the amount to collect, the supported payment methods, the expiration time for the transaction, and whether the payment method is to be tokenized. The payment intent also provides a means of tracking transactions involving multiple steps.
Common scenarios where a payment intent is used include:
- The merchant is processing a payment using AndDoneJS.
- The merchant wants to securely tokenize the customer’s payment method for use in future transactions.
Processing a payment intent transaction requires two steps. First the payment intent is created by calling the POST Create Payment Intent method. In this example, the saveForFuture
parameter is set to false
indicating that the customer’s payment method will not be tokenized. The payment amount
is $10.00. The accepted PaymentTypes
are credit card or debit card. The payment intent has an expiration period of 1 hour (3600 seconds).
Example: POST Create Payment Intent request body
{
"saveForFuture": false,
"amount": "10",
"title": "{{paymentTitle}}",
"shortDescription": "shortDescription",
"paymentDescription": "paymentDescription",
"invoiceNumber": "invoiceNumber-007",
"expiresIn": "3600",
"intent": {
"paymentTypes": [
"CreditCard", “DebitCard”
]
}
}
The payment intent request returns a paymentToken
in its response. This value is used to associate the subsequent secure payment transaction with the payment intent.
Example: POST Create Payment Intent response
{
"splits": null,
"saveForFuture": true,
"quoteKey": "null",
"accountNumber": "null",
"enablePremiumFinance": false,
"paymentToken": "Qvz7orxV",
"title": "Title_Car_608",
"amount": 10.0,
"invoiceNumber": "invoiceNumber-007",
"expireOn": "03-30-2023 16:40:10",
"shortDescription": "shortDescription",
"paymentDescription": "paymentDescription",
"intent": {
"paymentTypes": [
"CreditCard", “DebitCard”
]
}
}
Once the payment intent has been created, the payment transaction can be completed either by calling the secure payments API directly from the merchant application, or by using AndDoneJS.
Using Payment Intent with the Secure Payments API
The payment intent process can be completed using the AndDone secure payments API by calling the POST Create Secure Payment Request method directly from the merchant application. The transaction type
is PaymentIntent
. The paymentToken
value returned by the payment intent is passed in the token
parameter to establish the association between the payment transaction and the payment intent. The channelType
parameter indicates the method of payment.
Example: POST Create Secure Payment Request body
{
"type": "PaymentIntent",
"token": "Qvz7orxV",
"transactionCode": "Web",
"channelType": "CreditCard",
"tenderInfo": {
"cardHolderName": "Onkar",
"cardType": "VISA",
"cardNumber": "4151500000000008",
"cardExpiry": "0330",
"cvDataStatus": "AV",
"cvData": 737,
"removeDiscounting": false,
"createAccountToken": false
}
}
Using Payment Intents with AndDoneJS
AndDoneJS provides PCI compliant payment processing by means of an embedded UI that customers can access through the merchant’s existing web site or app.
The PaymentToken
returned by the payment intent is required to initialize AndDoneJS. See Getting Started with AndDoneJS for instructions on initializing AndDoneJS and processing secure payment transactions.
Retrieving Payment Intent Details
In some cases it is necessary to access the details of a specific payment intent transaction. The POST Get Payment Details by Token method allows you to retrieve the details of a payment intent, in-progress or completed, by providing the unique paymentToken
associated with the payment intent. The type
parameter is set to PaymentIntent
.
Example: POST Get Payment Details by Token request body
{
"paymentToken": "wKvoMb8y",
"type": "PaymentIntent"
}
The POST Get Payment Details method returns the details of the payment intent transaction associated with the paymentToken
.
Example: POST Get Payment Details by Token response
{
"transactionId": "d1523530-4e66-4c29-ba68-96e39d83104d",
"billingContact": [
{
"name": [
{
"title": "title",
"firstName": "John",
"middleName": "",
"lastName": "Smith"
}
],
"companyName": "",
"department": "",
"fax": "",
"phone": "8003213388",
"alternatePhone": "",
"mobile": "",
"email": "",
"url": ""
}
],
"address": [
{
"addressLine1": "30",
"addressLine2": "Memorial Drive",
"city": "Avon",
"state": "NY",
"country": 1,
"postalCode": "12701",
"timeZone": null
}
],
"transactionDate": "11-11-2022 08:15:58",
"merchantId": "wKvoMb8y",
"processMethod": "CardNotPresent",
"transactionOrigin": "PaymentIntent",
"refundOrigin": 0,
"achTenderInfo": "",
"ccTenderInfo": [
{
"cardHolderName": "Azhar Dave",
"cardType": "VISA",
"maskCardNumber": "****0008",
"cardExpiry": "0330",
"captureAmount": 50,
"amount": 50,
"tipAmount": 0,
"convenienceAmount": 0,
"binNumber": "415150",
"taxAmount": 0,
"taxAfterDiscount": false,
"taxPercent": 0,
"adjustmentPercentValue": "",
"adjustmentFixedValue": "",
"adjustmentAmount": "",
"adjustmentDisplayName": "",
"adjustmentDescriptorMessage": "",
"paymentAdjustmentType": "None",
"preAuthCode": "",
"maskAccount": "",
"accountToken": "",
"accountTokenMessage": "",
"createAccountToken": false,
"discountType": "Fixed",
"discountPercent": 0,
"discountAmount": 0,
"commissionType": "Percentage",
"commissionValue": 2.99
}
],
"debitCardTenderInfo": "",
"referenceCustomerId": "",
"customerAccountId": "",
"invoiceNo": "invoiceNumber-007",
"remarks": "",
"transactionStatus": "Authorized",
"transactionResult": [
{
"success": true,
"processorAuthCode": "Authorised",
"traceNumber": "D4L8TLN7B3RZNN82",
"reasonCode": "",
"reasonMessage": ""
}
],
"invoiceId": "",
"paymentLinkId": "KvoKpVvy",
"additionalFields": "{\"policynumber\":\"123456\"}",
"transactionEntitySplitResponses": [
{
"accountAlias": "VirtualAccount1",
"amount": 18.5,
"chargeIndicator": 1
},
{
"accountAlias": "VirtualAccount2",
"amount": 30,
"chargeIndicator": 0
}
]
}