Learn how to securely manage payment methods in the Stax Core Data API, including creating, retrieving, updating, and deleting payment methods for seamless customer transactions.
Use the Stax Core Data API to create, retrieve, update, and delete your customers' saved payment methods (credit cards, debit cards, and bank accounts).
This API reference overview is for developers integrating saved payment methods into an application. Stax stores payment methods using tokenization (replacing sensitive payment data with a unique identifier you can use for subsequent API requests).
Choose Your Integration Approach
Tokenization replaces sensitive payment data with unique identifiers to help protect customer information and support your Payment Card Industry Data Security Standard (PCI DSS) compliance efforts. It does not establish compliance on its own; consult your security and compliance teams about the requirements for your integration.
Prefer Stax.js for client-side card tokenization to avoid sending raw card information through your server. Server-side API calls are also available; review the PCI DSS requirements for handling raw card information with your security and compliance teams before choosing that approach.
Core Operations
Payment methods can be created by tokenizing sensitive payment information using client-side libraries like Stax.js or server-side API calls.
Important: Meeting the PCI DSS requirements applicable to your integration is required. We recommend client-side tokenization with Stax.js to support your compliance efforts; this recommendation does not replace those requirements.
Modify details of an existing payment method, such as updating the expiration date or metadata without re-tokenizing.
Soft-delete a payment method, making it inaccessible for future transactions. The payment method is marked as deleted but not permanently removed.
Need to import tokenized credit cards from your current processor? Contact your Account Manager or Partner Success Manager for assistance.
Retrieve saved payment methods with GET /payment-method. Start with the default page size of 20 records; per_page accepts integers from 1 to 200. See Get all Payment Methods for a Merchant for authentication, request parameters, and response examples.
Retrieve all non-deleted payment methods for a specific customer to display saved payment options or manage their methods.
Retrieve detailed information about a specific payment method using its unique ID, including card brand, last four digits, and expiration date. Obtain the ID from the payment method creation response or the data[].id field returned by GET /payment-method. For example, "7e3a83ea-6770-41f7-9b28-7ea1a3ae33e7" illustrates the ID format; use an ID returned for your own account, not this example value.
Use only mock data in your sandbox account. For successful card tokenization, use Visa test number 4111111111111111, a future expiration date, and a valid-length card verification value (CVV, the card's security code). A successful tokenization creates a payment method without applying a payment. See Testing Workflows in your Sandbox for bank account test data and payment failure scenarios.
Optional: Extend Your Integration
Card Information Details
When retrieving payment method information for cards, you get access to additional metadata:
Card Type Detection
- Debit or Credit Indicator: The
bin_typeparameter indicates if the card is "DEBIT" or "CREDIT" - Prepaid Card Check: The
meta.prepaidboolean indicates if the card is a prepaid debit or gift card
Available Information
- Card brand (Visa, Mastercard, etc.)
- Last four digits
- Expiration date
- Additional metadata and security indicators
Third-Party Integration
Share a Payment Method with a Third Party
Enable merchants to copy an existing Stax payment method to an external gateway without re-entering card details. This is useful when integrating with third-party services that require access to the payment method.
Important Note: Requires a
gateway_token. Contact your Partner Success representative for details.
Surcharge Calculation
Review a Transaction's Surcharge Information
Calculate a surcharge (an additional fee for using a payment method) from a payment_method_id and transaction amount. Use the payment method's id returned when you create or retrieve it, rather than a customer ID or card number. Use the result to inform customers of additional fees before processing their payment.
Key Details:
- Surcharge Calculation: Only applicable to credit cards and when the merchant has surcharging enabled
- Surcharge Details: Provides the surcharge rate and amount for transparency
- Customer Communication: Use this information to inform customers of additional fees before processing
Best Practices
Prefer client-side tokenization with Stax.js for credit card information to support your PCI DSS compliance efforts. Confirm the requirements for your integration with your security and compliance teams; tokenization alone does not establish compliance.
Use the mock card and bank account data in Testing Workflows in your Sandbox. Verify successful tokenization creates a payment method, and test payment success and failure separately before using live data.
Regularly review and manage stored payment methods to maintain data hygiene and customer experience.
