Skip to main content

Radom integrated checkout

Radom integrated checkout is the most customizable and flexible way to integrate crypto payments into your platform. The lifecycle of a radom integrated checkout works as follows:

  1. Show your user the crypto payment methods you would like to accept
  2. Upon selection of a payment method, create a payment session with Radom's API
  3. Show the payment session payment details to your user
  4. User completes the payment
  5. You receive a webhook message confirming the payment

Creating an API token

In order to use the Radom integrated checkout go to the Developer API tokens page in the Radom Dashboard and generate an API token. Make sure to store this somewhere securely as it can only be viewed once after creation, lost API tokens cannot be recovered and a new one will need to be generated.

Creating a payment session

Creating a payment session should be done on a secure back-end server, and is usually done when triggered by a request from your customer facing front-end application sending an order request to the back-end server when the customer is ready to checkout.

In the example below, a payment session is created using USDC on Ethereum:

{
"total": 39.99,
"currency": "USD",
"method": {
"network": "Ethereum",
"token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
}
}

Detailed information about using payment session API can be found in the payment session API Reference.

Using the payment session API response

{
"id": "9280fe2b-888d-4a9c-9a2d-511e6b1d512a",
"method": {
"network": "Ethereum",
"token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
},
"total": "1",
"currency": "USD",
"sessionStatus": "pending",
"paymentTotal": "1",
"paymentAddress": "0x9d0615b0fd5b3e4049cbfa85b2cb451ac0273a00",
"transactions": [],
"canExtend": true,
"expiresAt": "2023-06-13T21:11:36.781920Z",
"createdAt": "2023-06-13T20:41:36.746231Z"
}

The payment session API response includes four fields important for payment:

  1. method - The payment method your user should use to make the payment.
  2. paymentAddress - The address which your user should send funds to.
  3. paymentTotal - The total amount your user should send to. Note: this amount is not formatted using token or currency decimals, but is the human readable representation of the total, e.g. 1 USDC on Ethereum means 1000000 USDC as USDC has 6 decimals on Ethereum mainnet.
  4. expiresAt - The time until the sesssion is active. It's important to display this to your user as countdown to avoid sending funds to an expired session, which could result in lost funds.

Receiving webhook notifications

Webhook messages are JSON objects which contain two fields:

  1. eventType - determines the type of webhook event. For one-time checkouts, the type will be managedPayment. For subscription products, the type will be managedRecurringPayment.
  2. eventData - contains an object keyed with the eventType that includes information about the event, such as the payment amount, network, and token.
  3. radomData - information about associated radom payment entities at checkout, e.g. checkout session ID, payment link ID, payment session ID, etc.

For example:

{
"eventType": "managedPayment",
"eventData": {
"managedPayment": {
"paymentMethod": {
"network": "SepoliaTestnet",
"token": "0xa4fCE8264370437e718aE207805b4e6233638b9E"
},
"amount": "3.48250000000",
"transactions": [
{
"network": "SepoliaTestnet",
"transactionHash": "0x12968348c62356d30fd65b60e08e62a95129d66b4c9b40b25358fc63c105309a",
"token": "0xa4fce8264370437e718ae207805b4e6233638b9e",
"amount": "0.5000",
"blockTimestamp": "2023-06-04T01:50:12Z"
},
{
"network": "SepoliaTestnet",
"transactionHash": "0xf1fda84316ee0155bf817289ec00ee12f55944bcf6aa41f447958cfa30dc0be6",
"token": "0xa4fce8264370437e718ae207805b4e6233638b9e",
"amount": "3",
"blockTimestamp": "2023-06-04T01:52:00Z"
}
]
}
},
"radomData": {
"paymentSession": {
"paymentSessionId": "caed490d-f1c7-4da0-b53c-797a784f32bb"
}
}
}

See also

Webhook messages
Supported payment methods
Hosted checkout
Testnet token faucet