Skip to main content

Create Token

Create a payment token to securely store customer payment information. Tokens are used to create subscriptions and have a 24-hour expiration period to ensure security.

POSThttps://api.efundpay.com/v4/tokens
This endpoint requires the subscriptions.write scope.

Authorizations

Authorizationstringheaderrequired

Bearer authentication header in the format `Bearer <token>`, where `<token>` is your authentication token.

Headers

x-merchant-account-idstringrequired

Merchant account ID for this request.

Examples:""default""

Body

application/json
external_identifierstringrequired

Merchant reference identifier for this token. Used to identify the token in your system.

Length:1 - 64
Examples:"token-12345"
amountintegerrequired

Subscription amount in cents (smallest currency unit).

Examples:"1000""2999"
currencystringrequired

Subscription currency (ISO 4217 format).

Examples:"USD""EUR"
customerobjectrequired

Customer information object.

payment_methodobjectrequired

Payment method information object. If the merchant does not have PCI compliance, use checkout mode to redirect to the payment page to collect card information.

billing_detailsobject

Billing details for this token.

cart_itemsarray

Array of cart items representing token line items.

browser_infoobject

Browser information used by the customer. **Required for direct API mode**. This can be used for anti-fraud services.

metadataobject

Custom key-value pairs for additional information.

Examples:"{"source": "website", "campaign": "summer_promotion"}"

Response

application/json

Successful Response

idstring | null

Unique token identifier. If null, the user needs to complete payment through payment_url_link. Token ID will be returned via webhooks after successful payment.

Examples:"token_1234567890abcdef""null"
objectstringrequired

Object type, always "token".

Examples:"token"
createdstringrequired

Token creation time (ISO 8601).

Examples:"2025-08-12T09:00:00Z"
amountintegerrequired

Subscription amount in cents (smallest currency unit).

Examples:"1000"
currencystringrequired

Subscription currency (ISO 4217 format).

Examples:"USD"
customerobjectrequired

Customer information with generated ID.

payment_methodobjectrequired

Payment method information.

expires_atstringrequired

Token expiration time (ISO 8601).

Examples:"2025-08-13T09:00:00Z"
payment_url_linkstring | null

URL to complete payment for this token. **Required when id is null**. Users must complete payment through this link to receive the token ID via webhooks.

Examples:"https://pay.efundpay.com/token/abc123""null"
curl --request POST \
--url https://api.efundpay.com/v4/tokens \
--header 'Authorization: Bearer <token>' \
--header 'x-merchant-account-id: <x-merchant-account-id>' \
--header 'Content-Type: application/json' \
--data '{
"external_identifier": "token-12345",
"amount": 1000,
"currency": "USD",
"customer": {
"display_name": "John Doe",
"external_identifier": "customer-12345",
"first_name": "John",
"last_name": "Doe",
"email_address": "john@example.com",
"phone_number": "+1234567890",
"account_number": "123456789"
},
"payment_method": {
"payment_channel_code": "card",
"type": "card",
"webhooks_url": "https://merchant.com/webhooks/token",
"card": {
"number": "4111111111111111",
"expiration_date": "12/27",
"security_code": "123"
}
},
"cart_items": [{
"name": "Premium Plan",
"description": "Premium subscription plan with advanced features",
"quantity": 1,
"unit_amount": 1000,
"discount_amount": 0,
"tax_amount": 0,
"external_identifier": "premium-plan",
"sku": "PREMIUM001",
"product_url": "https://example.com/catalog/premium-plan",
"image_url": "https://example.com/images/premium-plan.jpg",
"categories": ["subscription", "premium", "feature"],
"product_type": "service"
}],
"browser_info": {
"javascript_enabled": true,
"java_enabled": false,
"language": "en-US",
"color_depth": 24,
"screen_height": 1080,
"screen_width": 1920,
"time_zone_offset": -480,
"user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
"user_device": "desktop",
"accept_header": "*/*"
},
"billing_details": {
"first_name": "John",
"last_name": "Doe",
"email_address": "john@example.com",
"phone_number": "+1234567890",
"address": {
"city": "San Jose",
"country": "US",
"postal_code": "94560",
"state": "California",
"state_code": "US-CA",
"house_number_or_name": "10",
"line1": "Stafford Appartments",
"line2": "29th Street",
"organization": "EFundFlow"
}
}
}'
{
"id": null,
"object": "token",
"created": "2025-08-12T09:00:00Z",
"amount": 1000,
"currency": "USD",
"customer": {
"id": "cus_abc123",
"display_name": "John Doe",
"external_identifier": "customer-12345",
"first_name": "John",
"last_name": "Doe",
"email_address": "john@example.com",
"phone_number": "+1234567890",
"account_number": "123456789"
},
"payment_method": {
"type": "card",
"card": {
"brand": "visa",
"last4": "4242",
"exp_month": 12,
"exp_year": 2027
}
},
"expires_at": "2025-08-13T09:00:00Z",
"payment_url_link": "https://pay.efundpay.com/token/abc123"
}
Powered by Docusaurus