Storing Payment Methods

Identify customer- and merchant-initiated payments, set transaction characteristics, and charge saved payment methods with the Stax API.

As a developer, identify who initiates a payment and whether it follows a schedule when you charge a saved payment method through the Stax API.

The Stored Credential Transaction framework (card-brand rules for identifying when you first save a customer's payment details and when you use those saved details again) distinguishes the initial storage from later use. Stax's transaction fields support your compliance efforts; they do not guarantee compliance. Consult your legal and compliance teams regarding specific requirements.

Set transaction characteristics

Required API Properties

If you integrate directly with the Stax Charge API or Stax Pay an Invoice API, supply the transaction characteristics described below. These fields describe the payment; supplying them alone does not establish compliance.

Include these properties in the request body's meta object when you call POST /charge:

1. meta.transaction_initiation_type (required, string)

  • Values: MIT or CIT
  • Usage: Use MIT for a Merchant-Initiated Transaction (a payment you initiate with the customer's prior permission, without their active participation). Use CIT for a Customer-Initiated Transaction (a payment the customer actively initiates at checkout).

2. meta.transaction_schedule_type (required, string)

  • Values: scheduled or unscheduled
  • Usage: "Scheduled" denotes a recurring transaction or installment; "unscheduled" signifies a new payment not linked to any recurring schedule

Stax Scheduled Payments

Automated Payments

If you are using the Stax Scheduled Invoices APIs or Stax Pay Schedules within the portal for autopayments, the Stax system generates these payments automatically. No additional actions are required.

One-Time Payments

Using Stax Hosted Payments Page, Payment Links, or StaxJS pay() method for one-time payments are all customer-initiated and unscheduled. Stax's system populates the correct transaction characteristics automatically.

Custom Schedules

If you opt to use your own schedule, you must include the specified data fields in Charge API requests and correctly identify whether an invoice is first-time or recurring.

Understanding Transaction Types

Customer Initiated Transaction (CIT)

When the customer actively participates in checkout

  • Customer engagement: Active involvement, either physically in-store or online
  • Initiation: Customer starts the payment process by providing payment details
  • Real-time interaction required
Merchant Initiated Transaction (MIT)

When merchant charges without active customer involvement

  • Pre-authorization: Customer has previously allowed merchant to initiate transactions
  • Dependency: Generally follows a CIT to capture necessary authorization
  • No customer presence required

Transaction Flow

Initial Transaction (CIT):

Subsequent Transactions (MIT):

Implementation Examples

Customer Initiated (CIT) One-time Payment (Unscheduled)

You build your own hosted payment page where the customer can make a one-time payment.

Replace the sample payment_method_id with the id returned by a successful staxjs.tokenize() call (which securely stores the card and returns its payment method ID). See Tokenizing a Credit Card. The UUID below illustrates the documented ID format; it is not a usable credential. This POST /charge request charges $150 immediately: total is in dollars and pre_auth: false takes payment rather than only reserving funds.

{
  "payment_method_id": "2e34394f-5f1d-4ec0-a56d-f669509a5b13",
  "total": 150,
  "pre_auth": false,
  "meta": {
    "transaction_initiation_type": "CIT",
    "transaction_schedule_type": "unscheduled"
  }
}

Merchant Initiated (MIT) One-time Payment (Unscheduled)

The customer orders a product online and later adds accessories. With the customer's prior permission to initiate the payment, you charge the saved payment method without their active participation in checkout.

Replace the sample payment_method_id with the id you saved from the customer's successful staxjs.tokenize() response; see Tokenizing a Credit Card. The UUID is sample data, not an ID to reuse. Send this body to POST /charge to take $150 immediately rather than only reserving funds.

{
  "payment_method_id": "2e34394f-5f1d-4ec0-a56d-f669509a5b13",
  "total": 150,
  "pre_auth": false,
  "meta": {
    "transaction_initiation_type": "MIT",
    "transaction_schedule_type": "unscheduled"
  }
}

Check the payment result

A successful POST /charge response includes success: true and a transaction id. Confirm success before showing payment success; do not treat a response with success: false or an error as a completed payment.

For example, these fields from a successful response identify the outcome and transaction:

{
  "success": true,
  "id": "ad107d1a-819b-45f8-9f46-0260a3b05d26",
  "type": "charge"
}

If you receive HTTP 422, inspect the field-specific errors. An invalid or unauthorized payment_method_id means you must check the saved ID and its merchant account; an invalid transaction characteristic means you must use the listed meta values. If the payment method has been deleted or redacted (removed from use), obtain a new payment method before attempting another charge.