Skip to main content

Prepare Payment

Authorize and generate the blockchain transaction data (calldata) required to execute the payment.

POST /payment/prepare

EIP-712 Authorization

This endpoint requires an EIP-712 signature with the purpose prepare_payment. This signature acts as the final confirmation from the user to execute the transaction.

Request Parameters

FieldTypeRequiredDescription
messageObjectThe EIP-712 message object signed by the user.
message.purposeStringMust be prepare_payment.
message.sessionIdStringThe Session ID.
message.merchantIdStringThe Merchant ID.
message.payerAddressThe payer address.
message.payerEmailStringThe payer email.
message.paymentChainIdStringThe chain ID.
message.paymentTokenAddressThe token address.
message.authorizationNonceBytes32Unique nonce.
message.authorizationExpiresAtTimestampExpiration time.
signatureBytesThe EIP-712 signature.

Request Example

{
"message": {
"purpose": "prepare_payment",
"sessionId": "sess_example_payment_03",
"merchantId": "f7d65b193454db46fb2d6277e2f5e593bffcf6adde5064a2bb5dee6fd9b0fb7a",
"paymentChainId": "137",
"paymentToken": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
"payer": "0x1234567890123456789012345678901234567890",
"payerEmail": "test@example.com",
"authorizationNonce": "0x3132...",
"authorizationExpiresAt": "1769488108"
},
"signature": "0x48a654a..."
}

Response Structure

The response contains the calldata for the blockchain transaction and the paymentExecutionGuide in the aiView.

Response Example

{
"calldata": "0xa9059cbb000000000000000000000000f7d65b193454db46fb2d6277e2f5e593bffcf6ad00000000000000000000000000000000000000000000000000000000002de6b0",
"aiView": {
"pricingModel": { "type": "fixed" },
"paymentExecutionGuide": {
"authorizationRequired": false,
"executionRequest": {
"purpose": "execute_payment_guide",
"sessionId": "sess_example_payment_03",
"txRequest": {
"chainId": "137",
"to": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
"data": "0xa9059cbb...",
"value": "0"
},
"userReview": {
"description": "This transaction will execute the prepared payment on-chain.",
"irreversible": true
}
}
},
"workflow": {
"stage": "payment_prepared",
"nextAction": {
"action": "execute_payment_client_side",
"description": "Client must execute the on-chain transaction."
}
}
}
}

Error Handling

This endpoint follows the Unified Error Handling standard. Business errors return HTTP 200 with a non-zero code.