Accept Payments Online
Quickly enable online payments using GETTRX's SDK and APIs. Embed a payment form in your page and securely process payments from your server.
How it works:
Accepting payments is as simple as two steps: securely collecting payment details using the JS SDK, and then securely finalizing the payment from your server.
- 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
and an amount
.
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"
}
'
Congratulations 🎉
Congratulations on finishing the two steps to get your online payments 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 10 months ago