Finish a checkout session

This API endpoint completes the checkout session once the PIN is verified.

📘

Where to get pinToken

The token is created from userId and user’s pin.

const crypto = require('crypto');
const getPinToken = (userId, pin) => {
  return crypto.createHash('sha256').update(`${pin}${userId}`).digest('hex');
}

Related guide(s): Capture method, Retrieve all payment methods of a user, How payment intents work and Payment intent status.

Successful response payload data

ParameterData typeDescription
merchantIdstringThe merchant ID of a particular merchant.
apiKeystringThe partner’s x-api-key used for authenticating partner's identity.

This key is provided during the onboarding process.
referenceIdstringA unique string to reference the checkout transaction.

This can be an order ID, a cart ID, or something similar generated by the merchant’s side.
referenceTypestringThe name of service which initiated the checkout flow.
capturebooleanAn identifier to see if the transaction is a captured transaction.

More information can be found in the capture method page.
amountstringThe total amount of all items after discounts and taxes.
currencystringThe three-letter ISO currency code of the payment.

Currently, only supports MYR which is the default value.
paymentMethodobjectThe payment method for this session.
paymentMethod.familystringThe family the payment method belongs to.
paymentMethod.typestringThe payment method type.
paymentMethod.brandstringThe payment method brand.
referenceMetaobjectAn object to store additional information about the transaction (e.g., order details, etc.).
referenceMeta.itemsobjectStores an array of items that is included in the transaction.
referenceMeta.items.itemNamestringName and description of the item.
referenceMeta.items.variationNamestringItem variation.
E.g: M, Red.
referenceMeta.items.unitPricefloatThe price per item.
referenceMeta.items.quantityintegerThe number of items purchased.
referenceMeta.items.totalPricefloatTotal price = item quantity x item unit price
referenceMeta.items.totalDiscountedPricefloatThe total price after discount.
referenceMeta.totalDiscountfloatThe total amount of discount given.
referenceMeta.subtotalfloatThe total amount before applying any taxes or discount, fee, etc.
referenceMeta.shippingFeefloatThe shipping fee (applicable for e-commerce).
referenceMeta.pumpNumberstringThe code for the pump being operated.
referenceMeta.stationNamestringThe name of the station where the operating pump is located.
subMerchantobject⚠️Required for Third-Party Acquirers
Partner's merchant information (lowest level merchant).

This will be used to display on our checkout page and e-receipt.
subMerchant.namestringThe name of partner's merchant.
subMerchant.referencestringThe partner's merchant's ID provided by partners.
idstringThe ID of the checkout session.
paymentMethodDetailobjectAdditional information about the payment method.
paymentMethodDetail.paymentMethodIdstringThe ID of the payment method used.

This ID is the id from the Retrieve all payment methods of a user API.
paymentMethodDetail.userIdstringThe ID of the user.
paymentProcessorstringIndicates the service that processes the payment intent.
paymentIntentIdstringThe unique identifier for the payment transaction.

More information can be found in the How payment intents work page.
paymentIntentStatusstringThe current status of the payment intent.

The full list of statuses can be found in the Payment intent status page.
expirationTimestringAfter this time, the session will expire. It is 900000 ms after creating a session.
errorstringDisplays the error that is returned by the Setel server.
statusstringThe status of the session.
createdAtdate stringThe time the checkout session was created.
updatedAtdate stringThe time the checkout session was last updated.
Language
Click Try It! to start a request and see the response here!