Aptean is now providing facility to integrate ApteanPay with 3rd party eCommerce websites via hosted checkout page. This can be done by making a server side call to ApteanPay API service.
In this document, we will guide you on how to create checkout session and make payment via hosted page.
NOTE: Do reach out CST team to provide access in order to use checkout session for your merchant account.
Theses are the mandatory headers required for ApteanPay Merchant API (GraphQL).
{
"x-aptean-apim":"<<<your product specific checkout service apim key here>>>",
"x-aptean-product":"<<<your product specific product id key goes here>>>",
"x-aptean-tenant":"<<<your tenant id here>>>",
"x-aptean-tenant-secret": "<<<your tenant secret here>>>"
}
Please fill your respective values appropriately to use them.
The following steps are based on using the staging site and the GraphQL playground. Production calls should be integrated into your application.
Open your browser and navigate to Merchant Portal based on your environment:
Staging: https://stg.api.apteanpay.com/
Get the http headers required from here.
Paste the headers in the HTTP HEADERS tab.
Copy below text including the brackets and paste in query/mutation section.
mutation createCheckoutSession($input: CreateCheckoutSessionInput!) {
createCheckoutSession(input: $input) {
message
code
error
errorReason{
code
details{
code
message
}
message
}
checkoutSession {
id
checkoutUrl
successUrl
cancelUrl
}
}
}
Copy below text including the brackets and paste in QUERY VARIABLES section.
{
"input": {
"amount": <<amount here>>,
"cancelUrl": "<<cancel url here>>",
"successUrl": "<<success url here>>",
"currency": "<<currency here>>",
"failOnReview": <<fail on review here>>,
"immediateCapture": <<immediate capture here>>,
"orderDetails": {
"customerReferenceNumber": "<<customer reference number here>>",
"lineItems": [
{
"currency": "<<currency here>>",
"description": "<<description here>>",
"quantity":<<quantity here>>,
"totalAmount": <<total amount here>>,
"unitOfMeasure": "<<unit of measure here>>",
"unitPrice": <<unit price here>>
}
],
"orderType": "<<order type here>>",
"shortDescription": "<<short description here>>",
"taxAmount": <<tax amount here>>
},
"payerDetails": {
"address": {
"city":"<<city here>>",
"country": "<<country here>>",
"line1":"<<address line2 here>>",
"line2":"<<address line1 here>>",
"postalCode": "<<postal code here>>",
"region":"<<region here>>"
},
"email": "<<email address here>>",
"name": "<<name here>>",
"phone": {
"countryCode": "<<country code here>>",
"number": "<<number here>>"
}
}
}
}
NOTE: Please provide complete success and cancel urls including https:// at the starting.
Now run the mutation.
Once you see the response code as SUCCESS, you can get the Checkout URL in the checkoutUrl field of the response.
Sample SUCCESS Response:
{
"data": {
"createCheckoutSession": {
"message": "Checkout session created.",
"code": "SUCCESS",
"error": null,
"errorReason": null,
"checkoutSession": {
"id": "c8b93d8e-7447-4798-bf50-3751b7f8f4c1",
"checkoutUrl": "https://stg.checkout.apteanpay.com/c8b93d8e-7447-4798-bf50-3751b7f8f4c1",
"successUrl": "https://stg.api.apteanpay.com/",
"cancelUrl": "https://stg.api.apteanpay.com/"
}
}
}
}
Get the checkoutUrl from createCheckoutSession mutation response and navigate to the checkout url.
You will be rediredted to ApteanPay checkout page as shown below

Fill in card information, contact information and then click on SUBMIT PAYMENT button.

Confirm the payment. Later you will be redirected to successUrl mentioned in the createCheckoutSession mutation.