Level 2 Payments
Optimize transaction costs with GETTRX's level 2 API.
How it works:
Processing level 2 payments is as simple as two steps: securely collecting payment details using the JS SDK, and then securely finalizing the payment from your server including the purchase order and tax information.
- Securely Collect Payment Details: Use the GETTRX One JS SDK to capture and tokenize payment details.
- Finalize Payment (
server-side
): Use GETTRX One’s APIs to process the payment from your server with the tokenized payment details.
1. Securely Collect Payment Details:
The GETTRX One JS SDK embeds a payment form into your page to securely collect payment details from your customer. When the payment details are collected, GETTRX tokenizes all the sensitive information and creates a PaymentToken
. Use the code sample below to learn how to create a PaymentToken
:
Tip:
Run the code sample locally to generate Payment Tokens for your account.
2. Finalize Payment (server-side
):
server-side
):Once the PaymentToken
is created, the last step is to complete the payment by creating a PaymentRequest
from your server.
Use GETTRX One’s Create a Payment API to create a PaymentRequest
with the PaymentToken
created in your UI, the currency
, the amount
, the level
and the additionalPaymentData
.
If the API request is successful you will receive a PaymentRequest
object with all the payment details. if it is not, you will receive an Error
response indicating why the transaction was not processed.
curl --request POST \
--url https://api-dev.gettrx.com/payments/v1/payment-requests \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'secretKey: sk_your_secret_key' \
--data '
{
"amount": 100,
"currency": "usd",
"paymentToken": "pt_your_payment_token",
"level": "2",
"additionalPaymentData": {
"purchaseOrder": "PO 12345",
"amountDetails": {
"tax": {
"amount": "12.05"
}
}
}
}
'
Congratulations 🎉
Congratulations on finishing the two steps to get your online payments with level 2 data up and running with GETTRX's SKDs and APIs!
You've securely collected payment details and finalized the payment, so you're all set to start processing transactions.
Your integration is now equipped to handle secure and efficient payments, providing a seamless experience for you and your customers. Happy coding!
Updated about 2 months ago