Finalise
Finialisation involves making API calls, displaying the transaction status, and responding to HTTP callbacks.
Flow Diagram
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
autonumber
actor u as User
participant b as Browser
participant cs as Customer Server
participant dt1 as DT One
u->>+b: Open customer's webpage
note over u, dt1: UI SDK initialized and the user selects and checkouts a product.
b->>cs: Payment Hook<br/>(Session ID extracted<br/>from Session Data, Payment Details)
activate cs
cs->>b: Render Payment Page
note over b, cs: Collect payment, finalise session and redirect<br/>to Transaction status view (Session ID)
note over b,dt1: The finalise session call should happen with 1 hour of payment hook
cs->>dt1: Finalise Session<br/>(Auth, Session ID, Payment Details)
activate dt1
dt1->>cs: Finalise Session Response
deactivate dt1
cs->>b: Render Transaction Status Page
deactivate cs
deactivate b
Steps
Finalise the session identified by the sessionID to confirm all transactions. Make this API call after you collect the payment.
- URL:
/v1/sessions/{sessionID}/finalise - Method:
POST
Request Body
[
{
"transaction_id": 65430,
"price": {
"currency": "SGD",
"amount": 9.9
}
}
]Response (200 OK)
[
{
"is_confirmed": true,
"transaction_id": 65430
}
]Errors
400: Bad Request401: Unauthorized403: Forbidden404: Not Found500: Server Error
Schemas
SessionFinaliseRequest
[
{
"transaction_id": "integer",
"price": {
"amount": "number",
"currency": "ISO 4217 code"
}
}
]SessionFinaliseResponse
{
"is_confirmed": true,
"transaction_id": "integer"
} Example
The callbacks.onSubmit function passes a Transaction object (described here: https://dvs-api-doc.dtone.com/#operation/getTransactionById) and a sessionId in the function parameters. Extract the transaction.id from the transaction object.
Examples
# Request
curl --location --request POST '<domain>/v1/sessions/{sessionID}/finalise' \
--header 'Content-Type: application/json' \
--user <APIKey:APISecret> \
--data '[ { "transaction_id": 125757, "price": { "currency": "SGD", "amount": 21.613 } }]'
# Response
[ { "transaction_id": 125758, "is_confirmed": true }]The transaction status page can be retrieved using the Session ID. For more information about how the Transaction Status page is configured, see the description of the template parameter of the Configuration file.
Once the session is finalised, DT One will start processing the transaction and will send an HTTP callback to the callbackUrl provided during the SDK initialization once processing is completed. This callback contains the final status of the transaction.
-
If the transaction status is Completed, you can complete the payment.
-
If the transaction status is Declined or Rejected, you must either refund the user or cancel the payment authorization.
-
Refer to the transaction status changes and corresponding callback calls here: DT One - Digital Value Services API
Updated about 5 hours ago
