Get Payment Credentials

Retrieves the payment credentials for a payment session the customer has already authorized through the hosted payment flow. Optionally pass the merchant URL to get credentials for a specific merchant.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Retrieves the payment credentials for a payment session the customer has already authorized through CartAI's hosted payment flow.

Use the sessionId you received from Create Payment Session, and optionally pass the merchant URL to get credentials for a specific merchant.

How it Works

  1. Your backend calls POST /payment/session to create a payment session and stores the returned sessionId.
  2. The customer completes the hosted payment flow (Visa Intelligent Commerce or Mastercard Agent Pay).
  3. CartAI sends payment session status updates to your Payment Webhook. Wait for the status "approved".
  4. Once you receive "approved", your backend calls POST /payment/session/credentials with the sessionId (and optionally the merchantUrl) to get the payment credentials for that session.
💡

Configure Payment Webhooks to listen for payment session status updates. A status of "approved" is your cue to call this API. Don't call it before the session is approved.

⚠️

Never expose your API key in client-side code. Always call this endpoint from your backend.


Authentication

Every request must include your API key in the request header.

x-api-key: YOUR_API_KEY_HERE

To get your API key, generate it from the CartAI Admin Portal after your account is provisioned. Contact the CartAI Account Management Team to request access.


Request Body

FieldTypeRequiredDescription
sessionIdstring✅ YesThe sessionId returned by POST /payment/session.
merchantUrlstringNoWebsite URL of the merchant the credentials will be used on (e.g. "https://saltiebeauty.com").

Full Request Example

curl --location 'https://api.cartai.ai/payment/session/credentials' \
  --header 'x-api-key: YOUR_API_KEY_HERE' \
  --header 'Content-Type: application/json' \
  --data '{
      "sessionId": "01a1d3ad-e7d9-7981-8a1e-c0a1b9ec65c1",
      "merchantUrl": "https://saltiebeauty.com"
  }'

Without a merchant URL:

curl --location 'https://api.cartai.ai/payment/session/credentials' \
  --header 'x-api-key: YOUR_API_KEY_HERE' \
  --header 'Content-Type: application/json' \
  --data '{
      "sessionId": "01a1d3ad-e7d9-7981-8a1e-c0a1b9ec65c1"
  }'

Response

A successful request returns HTTP 200 with the following body.

{
  "status": "success",
  "code": 200,
  "message": "Payment credentials retrieved and securely delivered",
  "data": {
    "type": "card",
    "info": {
      "cardNumber": "4242424242424242",
      "cvv": "234",
      "expiryMonth": "04",
      "expiryYear": "2027"
    }
  }
}

Response Fields

FieldTypeDescription
statusstring"success" when the credentials were retrieved.
codeintegerHTTP status code.
messagestringHuman-readable result message.
data.typestringCredential type (e.g. "card").
data.info.cardNumberstringCard number.
data.info.cvvstringCard verification value.
data.info.expiryMonthstringTwo-digit expiry month (e.g. "04").
data.info.expiryYearstringFour-digit expiry year (e.g. "2027").

Error Reference

HTTP StatusCauseWhat to do
200Credentials retrieved successfullyUse the returned credentials to process the payment
400Missing or invalid fields in the request bodyCheck that sessionId is present and well-formed
401Missing or invalid x-api-keyVerify the header name and that you are using the correct environment key
429Rate limitedBack off and retry after a delay
5xxCartAI server errorRetry with exponential backoff; contact support if it persists
Body Params
string
required

The sessionId returned by Create Payment Session

string

Optional. Website URL of the merchant the credentials will be used on

Headers
string
required
Responses

400

Bad Request

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json