> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.alphax.asia/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.alphax.asia/_mcp/server.

# Confirm card payment

POST https://public-api.alphax.com/card-payments/confirm
Content-Type: application/json

Confirm a card payment using the token returned by the Card Payment SDK's `submit()`.

Reference: https://docs.alphax.asia/api-reference/alpha-x-api/card-payments/confirm-card-payment

## Authentication

- `X-API-Key` header (required) — API Key authentication via header

## Servers

- `https://public-api.alphax.com` (Production server, default)
- `https://public-api.demo.alphax.asia` (Staging server)

## Request

### Body (application/json)

This endpoint expects a ConfirmCardPaymentRequest.

- `reference` (string, required) — Your unique payment reference (e.g. ORDER-123123)
- `token` (string, required) — Token returned by the Card Payment SDK's submit()
- `amount` (integer, required) — Amount in cents, minimum 100 (e.g. 1050 = 10.50 USD)
- `currency` (enum, required) — Currency in ISO 4217 3-letter format. Only USD is supported at the moment.
  - Allowed values: `USD`
- `billing` (CardPaymentBilling, required)

## Response

### 200

Card payment confirmed

- `transaction` (CardPaymentTransaction, optional)

## Errors

### 422 Unprocessable Entity Error

Validation errors

- `message` (string, optional)

## Types

### CardPaymentBilling

- `firstName` (string, required)
- `lastName` (string, required)
- `email` (string, required)
- `addressLine1` (string, required)
- `city` (string, required)
- `state` (string, required)
- `postalCode` (string, required)
- `countryCode` (string, required) — Country code in ISO 3166-1 alpha-2 format
- `phone` (string, optional, nullable)
- `addressLine2` (string, optional, nullable)

### CardPaymentTransaction

- `ulid` (string, optional) — Unique ULID of the transaction
- `reference` (string, optional) — Your payment reference
- `amount` (integer, optional) — Amount in cents (e.g. 1050 = 10.50 USD)
- `currency` (string, optional)
- `fee_amount` (integer, optional, nullable) — Fee amount in cents (e.g. 35 = 0.35 USD)
- `fee_currency` (string, optional, nullable)
- `status` (enum, optional, nullable) — Status of the card payment
  - Allowed values: `PROCESSING`, `AUTHORIZED`, `FAILED`
- `created_at` (datetime, optional)

## Examples

**Request**

```json
{
  "reference": "ORDER-123123",
  "token": "<token_from_sdk>",
  "amount": 1050,
  "currency": "USD",
  "billing": {
    "firstName": "John",
    "lastName": "Snow",
    "email": "john.snow@example.com",
    "addressLine1": "1 Raffles Place",
    "city": "Singapore",
    "state": "Singapore",
    "postalCode": "048616",
    "countryCode": "SG",
    "phone": "+6591234567",
    "addressLine2": null
  }
}
```

**Response**

```json
{
  "transaction": {
    "ulid": "01kqc6aaq3jshqyz6a0k8nkxfe",
    "reference": "ORDER-123123",
    "amount": 1050,
    "currency": "USD",
    "fee_amount": 35,
    "fee_currency": "USD",
    "status": "AUTHORIZED",
    "created_at": "2026-04-29T08:40:16+00:00"
  }
}
```

**SDK Code**

```python
import requests

url = "https://public-api.alphax.com/card-payments/confirm"

payload = {
    "reference": "ORDER-123123",
    "token": "<token_from_sdk>",
    "amount": 1050,
    "currency": "USD",
    "billing": {
        "firstName": "John",
        "lastName": "Snow",
        "email": "john.snow@example.com",
        "addressLine1": "1 Raffles Place",
        "city": "Singapore",
        "state": "Singapore",
        "postalCode": "048616",
        "countryCode": "SG",
        "phone": "+6591234567",
        "addressLine2": None
    }
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://public-api.alphax.com/card-payments/confirm';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"reference":"ORDER-123123","token":"<token_from_sdk>","amount":1050,"currency":"USD","billing":{"firstName":"John","lastName":"Snow","email":"john.snow@example.com","addressLine1":"1 Raffles Place","city":"Singapore","state":"Singapore","postalCode":"048616","countryCode":"SG","phone":"+6591234567","addressLine2":null}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://public-api.alphax.com/card-payments/confirm"

	payload := strings.NewReader("{\n  \"reference\": \"ORDER-123123\",\n  \"token\": \"<token_from_sdk>\",\n  \"amount\": 1050,\n  \"currency\": \"USD\",\n  \"billing\": {\n    \"firstName\": \"John\",\n    \"lastName\": \"Snow\",\n    \"email\": \"john.snow@example.com\",\n    \"addressLine1\": \"1 Raffles Place\",\n    \"city\": \"Singapore\",\n    \"state\": \"Singapore\",\n    \"postalCode\": \"048616\",\n    \"countryCode\": \"SG\",\n    \"phone\": \"+6591234567\",\n    \"addressLine2\": null\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://public-api.alphax.com/card-payments/confirm")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"reference\": \"ORDER-123123\",\n  \"token\": \"<token_from_sdk>\",\n  \"amount\": 1050,\n  \"currency\": \"USD\",\n  \"billing\": {\n    \"firstName\": \"John\",\n    \"lastName\": \"Snow\",\n    \"email\": \"john.snow@example.com\",\n    \"addressLine1\": \"1 Raffles Place\",\n    \"city\": \"Singapore\",\n    \"state\": \"Singapore\",\n    \"postalCode\": \"048616\",\n    \"countryCode\": \"SG\",\n    \"phone\": \"+6591234567\",\n    \"addressLine2\": null\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://public-api.alphax.com/card-payments/confirm")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"reference\": \"ORDER-123123\",\n  \"token\": \"<token_from_sdk>\",\n  \"amount\": 1050,\n  \"currency\": \"USD\",\n  \"billing\": {\n    \"firstName\": \"John\",\n    \"lastName\": \"Snow\",\n    \"email\": \"john.snow@example.com\",\n    \"addressLine1\": \"1 Raffles Place\",\n    \"city\": \"Singapore\",\n    \"state\": \"Singapore\",\n    \"postalCode\": \"048616\",\n    \"countryCode\": \"SG\",\n    \"phone\": \"+6591234567\",\n    \"addressLine2\": null\n  }\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://public-api.alphax.com/card-payments/confirm', [
  'body' => '{
  "reference": "ORDER-123123",
  "token": "<token_from_sdk>",
  "amount": 1050,
  "currency": "USD",
  "billing": {
    "firstName": "John",
    "lastName": "Snow",
    "email": "john.snow@example.com",
    "addressLine1": "1 Raffles Place",
    "city": "Singapore",
    "state": "Singapore",
    "postalCode": "048616",
    "countryCode": "SG",
    "phone": "+6591234567",
    "addressLine2": null
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://public-api.alphax.com/card-payments/confirm");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"reference\": \"ORDER-123123\",\n  \"token\": \"<token_from_sdk>\",\n  \"amount\": 1050,\n  \"currency\": \"USD\",\n  \"billing\": {\n    \"firstName\": \"John\",\n    \"lastName\": \"Snow\",\n    \"email\": \"john.snow@example.com\",\n    \"addressLine1\": \"1 Raffles Place\",\n    \"city\": \"Singapore\",\n    \"state\": \"Singapore\",\n    \"postalCode\": \"048616\",\n    \"countryCode\": \"SG\",\n    \"phone\": \"+6591234567\",\n    \"addressLine2\": null\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "reference": "ORDER-123123",
  "token": "<token_from_sdk>",
  "amount": 1050,
  "currency": "USD",
  "billing": [
    "firstName": "John",
    "lastName": "Snow",
    "email": "john.snow@example.com",
    "addressLine1": "1 Raffles Place",
    "city": "Singapore",
    "state": "Singapore",
    "postalCode": "048616",
    "countryCode": "SG",
    "phone": "+6591234567",
    "addressLine2": 
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://public-api.alphax.com/card-payments/confirm")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```