Server-side Configuration
Server-side
Generate a session_id
session_id
The first step in the Components process is to use your API credentials to authenticate and login. A request can then be submitted to the /payment-sessions
endpoint containing the fields of the transaction
and tds
objects. Please view our API reference for further information on this endpoint.
Request:
{
"transaction": {
"order_id": "41142534-2e55-4eb2-9553-59784c73b2b0",
"amount": 15.02,
"currency": "gbp",
"capture": true
},
"tds": {
"is_active": true,
"challenge_preference": "no_preference",
"contact_url": "https://yourdomain.com/contact",
"redirect_url": "https://yourdomain.com/redirect",
"webhook_url": "https://yourdomain.com/webhook"
},
"save_card": true,
"is_recurring": true,
"payment_methods": [
"card",
"apple_pay",
"google_pay"
]
}
Note
When utilising the Payment component, you can pass the
payment_methods
array. This allows merchants to specify which payment methods are displayed to the user.Please note, this can not be passed for the Form or Fields components.
As a result of a successful response, we will return a session_id
. When a payment is then completed using Components, the parameters set within the session_id
will be used to complete the payment. Session IDs are temporary and will expire after 10 minutes. After this time, a new session_id
will need to be generated.
Successful response:
{
"session_id": "6d07e15a-b8ab-41e9-993b-39fbe688da92"
}
If a request is submitted to the /payment-sessions
endpoint and a required parameter is not present, we will return a 400 error.
Example response:
{
"status": "error",
"error_type": "validation",
"title": "Your request parameters did not pass our validation.",
"instance": "/v1/payment-sessions",
"invalid_parameters": [
{
"parameter": "transaction.order_id",
"reason": "transaction.order_id can not be empty"
}
]
}
Updating a session_id
session_id
There will be instances where the initially entered amount undergoes alterations from the original request. This could occur for many reasons, including, when there is an increased delivery charge or the cardholder applies a coupon code.
In such cases, initiate a PUT request to the endpoint /payment-sessions/{session_id}
, incorporating the modified parameters. This allows changes to be submitted to any of the supported parameters. Following a successful response, when the payment is completed within Components, the authorisation request will use the latest parameter set against the session_id
. Please refer to the API reference for further details.
Updated 4 months ago