Charge Transaction
Endpoints
Charge Transaction
Process card payments using the charge endpoint
POST
Charge Transaction
Overview
The charge endpoint processes a payment using a nonce token obtained from card tokenization. This endpoint debits the customer’s card and credits your merchant account.Endpoint
- Sandbox
- Production
Authentication
Basic Authentication header with Base64 encoded
[API_KEY]:[PIN]Format: Basic [base64_credentials]Must be
application/jsonRequest Body
Transaction amount in dollars (e.g.,
5 for $5.00)Nonce token obtained from card tokenization (e.g.,
"nonce-pft4uav4cker5g8bk3db")Card expiry month (1-12)
Card expiry year (e.g.,
2028)Customer billing information
Optional transaction metadata for your internal tracking
Request Example
Response
Unique transaction identifier
Transaction status (e.g.,
"approved", "declined")Transaction amount
Currency code (e.g.,
"USD")Card information
Transaction timestamp (ISO 8601 format)
Authorization code from payment processor
Response Examples
Transaction Statuses
| Status | Description | Action |
|---|---|---|
approved | Transaction successful | Fulfill order |
declined | Card declined by issuer | Request different payment method |
pending | Transaction pending review | Wait for final status |
failed | Transaction failed | Check error details and retry |
Complete Payment Flow
Error Handling
card_declined
card_declined
Cause: Card issuer declined the transactionSolution:
- Ask customer to contact their bank
- Request alternative payment method
- Verify billing information is correct
invalid_nonce
invalid_nonce
Cause: Nonce token is invalid or expiredSolution:
- Re-tokenize the card to get a new nonce
- Ensure nonce is used immediately after generation
- Don’t reuse nonces
insufficient_funds
insufficient_funds
Cause: Card has insufficient fundsSolution:
- Request different payment method
- Ask customer to use another card
invalid_card
invalid_card
Cause: Card number or details are invalidSolution:
- Verify card number is correct
- Check expiry date is valid
- Ensure CVV is correct
authentication_error
authentication_error
Cause: Invalid API credentialsSolution:
- Verify API Key and PIN are correct
- Check Base64 encoding is proper
- Ensure using correct environment credentials
Best Practices
Use Nonce Immediately
Process charges immediately after receiving the nonce token
Validate Before Charging
Validate amount and billing info before calling the API
Handle All Statuses
Account for approved, declined, pending, and failed statuses
Log Transactions
Keep detailed logs of all charge attempts for reconciliation
Secure Credentials
Never expose API credentials on the client side
Use HTTPS Only
Always make API requests over HTTPS
Testing
Use these test scenarios in the sandbox:Successful Charge
- Card:
4111 1111 1111 1111 - Expected:
status: "approved"
Declined Card
- Card:
4000 0000 0000 0002 - Expected:
status: "declined"
Insufficient Funds
- Card:
4000 0000 0000 9995 - Expected:
status: "declined", error codeinsufficient_funds
Related Documentation
Tokenization
Learn how to tokenize card data
Authentication
Set up API authentication
