Skip to main content

Create Payment Session

Create a new Payment Session based on a Payment Link. This step instantiates the link into a specific transaction bound to a user, a chain, and a token.

POST /payment/session/create

EIP-712 Authorization

This endpoint requires an EIP-712 signature with the purpose create_payment_session. The user must sign the specific payment parameters (Amount, Token, Chain) to authorize the session creation.

  • Domain Name: aipay.gstable.io
  • Version: 1
  • Chain ID: The chain ID selected for payment.

Request Parameters

FieldTypeRequiredDescription
messageObjectThe EIP-712 message object signed by the user.
message.purposeStringMust be create_payment_session.
message.linkIdStringThe ID of the Payment Link.
message.linkVersionStringThe version of the Payment Link.
message.merchantIdStringThe Merchant ID.
message.payerAddressThe wallet address of the payer.
message.paymentChainIdStringThe chain ID where payment will occur.
message.paymentTokenAddressThe token address for payment.
message.amountStringThe payment amount in the smallest token unit.
message.authorizationNonceBytes32A random 32-byte hex string to prevent replay attacks.
message.authorizationExpiresAtTimestampExpiration time for this signature (seconds).
signatureBytesThe resulting EIP-712 signature string (0x...).

Request Example

{
"message": {
"purpose": "create_payment_session",
"linkId": "lnk_example_premium_plan_01",
"linkVersion": "ver_example_03",
"merchantId": "f7d65b193454db46fb2d6277e2f5e593bffcf6adde5064a2bb5dee6fd9b0fb7a",
"payer": "0x1234567890123456789012345678901234567890",
"paymentChainId": "137",
"paymentToken": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
"amount": "3009000",
"authorizationNonce": "0xc6086627cff7f653c382d6e75b7f5afa239125f69887ac63516afce9fd0f8345",
"authorizationExpiresAt": "1769486386"
},
"signature": "0xa6be9f1cdfcbb534d61ad327dadf3aefa3e6ca52889890dbb2318f949061c7f42e2dce8c7a7e6b5007ccdf8e484ef2b6c282eaa16889978b2278c53fa37b07ab1c"
}

Response Structure

Returns the created sessionId and the next stage of the AI View.

Response Example

{
"code": 0,
"message": "success",
"data": {
"sessionId": "sess_example_payment_04",
"sessionType": "ai_checkout",
"sessionExpiresAt": 1769484586,
"aiView": {
"pricingModel": { "type": "fixed" },
"workflow": {
"stage": "session_ready",
"nextAction": {
"action": "prepare_payment",
"authorizationRequired": true
}
},
"preparePaymentRequirement": {
"authorizationRequired": true,
"authorizationSpec": {
"type": "eip712",
"purpose": "prepare_payment",
// ... EIP-712 types for prepare_payment ...
}
}
}
}
}

Error Handling

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