Skip to main content
POST
Create Token Payment

Endpoint

Overview

Use this endpoint to process payments using TokenEx tokens generated from the Digitzs embedded checkout. This secure method keeps sensitive payment data out of your application while maintaining PCI compliance.
A TokenEx token must be generated through the Digitzs embedded checkout before using this endpoint. Contact Digitzs support to integrate the embedded checkout into your application.

Authentication

Request Body

data
object
required
Container for API data
data.requestId
string
UUID for idempotency. If provided, must be in valid UUID format. Recommended for preventing duplicate transactions.
data.type
string
required
Must be "payments"
data.attributes
object
required
Container for payment attributes
data.attributes.paymentType
string
required
Must be "tokenv3" for tokenized payments
data.attributes.merchantId
string
required
The merchant account identifier
data.attributes.miscData
string
Optional JSON string containing additional metadata like email, IP addresses, or custom data
data.attributes.token
object
required
Tokenized payment method information
data.attributes.transaction
object
required
Transaction details
data.attributes.billingAddress
object
required
Billing address information

Example Request

Response

Success Response (201 Created)

Contains URLs related to the resource
data
object
Container for response data

Example Response

Code Examples

AVS Result Codes

The avsResult field contains Address Verification System codes:

Error Responses

Common Error Scenarios

Error: 400 Bad RequestSolution: Ensure the tokenId is valid and was recently generated from the embedded checkout. Tokens may have a limited lifespan.
Error: 422 Unprocessable EntitySolution: When useAVS is true, ensure the billing address ZIP code matches the card’s billing ZIP. You can disable AVS by setting useAVS to false, but this may increase fraud risk.
Error: 402 Payment RequiredSolution: The card issuer declined the transaction. Common reasons include insufficient funds, expired card, or fraud prevention. Ask the customer to contact their bank or use a different payment method.
Error: 400 Bad RequestSolution: Ensure expiry is in MMYY format (4 digits, no separators). Example: “0229” for February 2029.

Important Notes

Token Security: Tokens should only be used once. Do not reuse tokens across multiple payment attempts.
AVS Recommendations: Enabling AVS (useAVS: true) provides additional fraud protection but may decline legitimate transactions if address information doesn’t match. Consider your risk tolerance when configuring this setting.
Embedded Checkout Required: Contact Digitzs support to integrate the embedded checkout into your application before using this endpoint. The checkout handles secure card data collection and tokenization.

Best Practices

  1. Use Idempotency Keys: Include requestId to prevent duplicate charges if requests are retried
  2. Collect Complete Addresses: Provide full billing address information for better AVS verification
  3. Handle Declines Gracefully: Display user-friendly error messages and offer alternative payment methods
  4. Store Payment IDs: Save the returned payment ID for reconciliation and potential refunds
  5. Implement Retry Logic: Handle transient errors with exponential backoff
  6. Monitor AVS Results: Track AVS result codes to identify potential fraud patterns

Understanding Transaction Fees

The response includes detailed fee breakdown:
  • gross: Total amount charged to the customer
  • fee: Fixed transaction fee (typically $0.30)
  • rate: Percentage fee (typically 2.9%)
  • grossMinusNet: Total fees charged (fee + percentage of gross)
  • net: Amount deposited to merchant account (gross - grossMinusNet)

Next Steps

Get Payment Details

Retrieve full details of a completed payment

Create Split Payment

Learn how to split payment proceeds across multiple accounts