API references
Search documentation... ⌘K
API references

Select payment method

This endpoint creates a new payment session with the customer's chosen payment method. It returns a payment session ID that you'll use in subsequent API calls to complete the payment flow.

The flow after calling this endpoint depends on the selected payment method:

  • For card payments: You must provide a card token obtained from tokenize-card
  • For QR code payments: Call retrieve-qr-data to get the QR code data to display
  • For redirect-based payments: Call get-redirect-url to get the URL to redirect the customer to

After starting the payment flow, you should poll discover-next-action to track the payment status and determine the next steps.

Endpoint signature
POST https://api.reservepay.com/sdk/select-payment-method HTTP/1.1
Content-Type: application/json
Accept: application/json
{
merchant_id: string,
installation_id: string,
amount: string,
currency: string,
payment_method: string,
token: string?,
customer_email: string?,
customer_mobile: string?,
customer_name: string?,
}
Returns: string
New to Reservepay? Read our guide on how to call endpoints to get started.
Request arguments
merchant_id string

Required. Your merchant ID that uniquely identifies your account.

installation_id string

Required. The installation ID for this platform (e.g. your iOS app, Android app, website, or terminal).

amount string

Required. The payment amount in the smallest currency unit (e.g. cents). Must be a positive integer.

currency string

Required. The three-letter ISO currency code (e.g. THB). Must match the funding currency configured for your provider.

payment_method string

Required. The payment method code (e.g. CARD, PROMPTPAY, K_PLUS). Must be enabled for your account.

token string

Optional. For card payments only: The card token obtained from tokenize-card. Required when payment_method is CARD.

customer_email string

Optional. Customer's email address. Required if the installation is configured to require email capture.

customer_mobile string

Optional. Customer's mobile phone number. Required if the installation is configured to require mobile capture.

customer_name string

Optional. Customer's name.

Errors specific to this endpoint
NOT_FOUND

This error occurs when we cannot find the merchant account, installation, or card token with the IDs provided. Double check that you are using the correct IDs.

TOKEN_ALREADY_USED

This token has already been used to create a payment session. Each token can only be used once. Request a new token from tokenize-card.

Errors common to all endpoints
UNHANDLED_ERROR

This error occurs when the server encounters an unexpected internal error that it cannot handle gracefully. This typically happens due to bugs, infrastructure issues, or edge cases that weren't anticipated during development.

INVALID_ARGUMENTS

This error occurs when the request contains invalid or missing parameters. Common cases include missing required fields, or values that don't match the expected format or type.

BAD_VERSION

This error occurs when making requests to an API version that is either deprecated or not yet released. This commonly happens when using an outdated SDK or when the API version specified in the request URL is incorrect.

CODE SAMPLES
curl
curl "https://api.reservepay.com/sdk/select-payment-method" \
  -X POST
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
        "merchant_id": "123456789012",
        "installation_id": "ins_xhBi6ypq9G",
        "amount": 100000,
        "currency": "THB",
        "payment_method": "CARD",
        "token": "IC3949UCOE6U93"
      }'

Learn how to run these code samples in your terminal by reading our guide.