AApt Commerce
Sign inGet started
Show for

Card Payments

Accept Visa, Mastercard, American Express, and Discover through our unified API.

Supported Card Brands

Visa
Mastercard
American Express
Discover

Creating a Card Payment

curl -X POST https://api.aptcommerce.com/v1/transactions \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "amount": 9900,
    "currency": "usd",
    "payment_method": "card",
    "card": {
      "number": "4242424242424242",
      "exp_month": 12,
      "exp_year": 2027,
      "cvc": "123"
    },
    "customer": "cust_abc123",
    "description": "Premium Plan",
    "metadata": { "order_id": "1234" }
  }'

Response

{
  "id": "txn_1a2b3c4d",
  "object": "transaction",
  "amount": 9900,
  "currency": "usd",
  "status": "completed",
  "payment_method": "card",
  "card": {
    "brand": "visa",
    "last4": "4242",
    "exp_month": 12,
    "exp_year": 2027
  },
  "customer": "cust_abc123",
  "created_at": "2026-03-14T12:00:00Z",
  "links": {
    "self": "/v1/transactions/txn_1a2b3c4d",
    "refund": "/v1/transactions/txn_1a2b3c4d/refund"
  }
}

Auth & Capture

By default, payments are authorized and captured immediately. To separate authorization from capture, set capture: false.

# Authorize only
curl -X POST https://api.aptcommerce.com/v1/transactions \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"amount": 9900, "currency": "usd", "payment_method": "card", "card": {...}, "capture": false}'

# Capture later (within 7 days)
curl -X POST https://api.aptcommerce.com/v1/transactions/txn_1a2b3c4d/capture \
  -H "Authorization: Bearer sk_live_..."

3D Secure

3D Secure authentication is automatically triggered when required by the card issuer. The API response will include a redirect_url field when additional authentication is needed. After the customer completes 3DS, they are redirected back and the payment completes.

Refunds

Issue full or partial refunds on completed card transactions:

# Full refund
curl -X POST https://api.aptcommerce.com/v1/transactions/txn_abc123/refund \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json"

# Partial refund
curl -X POST https://api.aptcommerce.com/v1/transactions/txn_abc123/refund \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"amount": 2500}'

Network Mandates

Card networks require stored-credential flags and a Network Transaction ID on later charges. APT exposes those as our own fields (`transaction_initiator`, `stored_credential`, `network_transaction_id`). A CIT is the buyer paying now; an MIT is you charging later. Authorization, Capture, and Sale are the money-path verbs — send the same APT mandate fields on all three when a method is on file. Live adapters translate to each processor. We follow the networks, not another vendor’s API.

stored_credentialSet to "initial" when saving a card, "subsequent" for later charges
transaction_initiator"customer" for CIT, "merchant" for MIT (subscriptions, no-show charges)
recurringSet to true for subscription/recurring billing
network_transaction_idInclude the original network txn ID for all subsequent stored credential uses

See the dedicated Network Mandates documentation for complete details, required fields by transaction type, and compliance timelines.

Settlement & Funding

Completed card transactions are batched and settled daily. The transaction response includes settlement details:

"settlement": {
  "settled_at": "2026-03-14T18:00:00Z",
  "expected_funding_date": "2026-03-16",
  "funding_status": "pending",  // pending | in_transit | settled | failed
  "batch_id": "batch_20260314"
}

Typical funding timelines: Card — T+2 business days. ACH — T+3-5 business days. Stablecoin — same-day settlement.