Add Payment Info Event
Track when users add payment information during checkout. This event maps to Facebook AddPaymentInfo
and TikTok AddPaymentInfo standard events and is part of the checkout funnel, helping measure
conversion drop-off at the payment step.
When to Use This Event
Trigger this event when a user successfully enters or selects their payment method during checkout:
- User enters credit card details
- User selects PayPal, Apple Pay, Google Pay, or other payment method
- User selects buy-now-pay-later option (Klarna, Afterpay, etc.)
| Platform | Event Name |
|---|---|
| Facebook Pixel / CAPI | AddPaymentInfo |
| TikTok Pixel / Events API | AddPaymentInfo |
Client-Side vs Server-Side Tracking
For each add-payment-info action, use either the JavaScript SDK or the server-side API — not both.
The JavaScript SDK automatically fires Facebook and TikTok pixels with a matching
eventID, then sends the event to the AxiTrace backend which forwards it to CAPI.
Facebook/TikTok deduplicates using the shared eventID, counting one event.
If you also send the same event via the server-side PHP SDK, it generates a different
eventID — causing Facebook/TikTok to count the event twice.
Recommendation: Use the server-side PHP SDK for checkout events where you typically have the customer's email (improves Facebook CAPI match quality by up to 41%). Use the JavaScript SDK only when server-side tracking is not feasible.
Request Parameters
User Identification
At least one of these identifiers is required:
| Field | Type | Description |
|---|---|---|
client_id |
string | Your custom user/visitor identifier (use SDK's vt_vid cookie value) |
user_id |
string | Authenticated user ID |
session_id |
string | Current session identifier (use SDK's vt_sid cookie value) |
Required Fields
| Field | Type | Required | Description |
|---|---|---|---|
currency |
string | Required | Currency code (ISO 4217, e.g., USD, EUR). Must be non-empty. |
value |
number | Required | Cart value. Must be >= 0. Maps to Facebook/TikTok value. |
items |
array | Required | Array of cart item objects. Must contain at least one item. |
Customer Data (for Facebook CAPI)
These top-level fields significantly improve Facebook CAPI Event Match Quality. During checkout, you typically have the customer's email — always include it.
| Field | Type | Description |
|---|---|---|
email |
string | Customer email address. Strongly recommended — improves Facebook CAPI match quality by up to 41%. Send as plain text — AxiTrace auto-hashes for Facebook. |
phone |
string | Customer phone number (E.164 format recommended). Send as plain text — AxiTrace auto-hashes for Facebook. |
Optional Fields
| Field | Type | Description |
|---|---|---|
payment_type |
string | Payment method (e.g., credit_card, paypal, apple_pay, klarna) |
coupon |
string | Applied coupon code |
params |
object | Additional parameters (Facebook CAPI data: fbp, fbc, first_name, last_name, etc.) |
Item Object
| Field | Type | Description |
|---|---|---|
item_id |
string | Product SKU or ID |
item_name |
string | Product name |
price |
number | Unit price |
quantity |
integer | Quantity in cart |
item_category |
string | Product category |
item_brand |
string | Product brand |
Examples
Client-Side (JavaScript SDK)
// Track payment info added during checkout
Axitrace._instance.track('add_payment_info', {
currency: 'USD',
value: 129.99,
payment_type: 'credit_card',
coupon: 'SAVE10',
items: [
{
item_id: 'SKU-12345',
item_name: 'Blue Running Shoes',
price: 99.99,
quantity: 1,
item_category: 'Footwear',
item_brand: 'Nike'
},
{
item_id: 'SKU-67890',
item_name: 'Sports Socks',
price: 15.00,
quantity: 2,
item_category: 'Accessories'
}
]
});
The JavaScript SDK automatically generates a unique eventID and:
- Fires
fbq('track', 'AddPaymentInfo', data, {eventID})in the browser - Fires
ttq.track('AddPaymentInfo', data, {event_id})in the browser - Sends the event to the AxiTrace backend with the same
eventID - The backend forwards to Facebook CAPI and TikTok Events API with the matching
eventID
Facebook/TikTok deduplicates using the shared eventID, counting one event from two sources.
Server-Side (AxiTrace PHP SDK)
<?php
use AxiTrace\AxiTrace;
// Initialize — auto-reads vt_vid, vt_sid, _fbp, _fbc cookies
$axitrace = AxiTrace::init('sk_live_YOUR_SECRET_KEY');
// Track payment info added during checkout
$response = $axitrace->addPaymentInfo(129.99, 'USD', [
[
'item_id' => 'SKU-12345',
'item_name' => 'Blue Running Shoes',
'price' => 99.99,
'quantity' => 1,
'item_category' => 'Footwear',
'item_brand' => 'Nike',
],
[
'item_id' => 'SKU-67890',
'item_name' => 'Sports Socks',
'price' => 15.00,
'quantity' => 2,
'item_category' => 'Accessories',
]
], [
'payment_type' => 'credit_card',
'coupon' => 'SAVE10',
]);
Server-Side (cURL)
# Add payment info with email for Facebook CAPI matching
curl -X POST https://stat.axitrace.com/v1/checkout/add_payment_info \
-u "sk_live_YOUR_SECRET_KEY:" \
-H "Content-Type: application/json" \
-d '{
"client_id": "value-from-vt_vid-cookie",
"session_id": "value-from-vt_sid-cookie",
"email": "customer@example.com",
"phone": "+1-555-123-4567",
"currency": "USD",
"value": 129.99,
"payment_type": "credit_card",
"coupon": "SAVE10",
"items": [
{
"item_id": "SKU-12345",
"item_name": "Blue Running Shoes",
"price": 99.99,
"quantity": 1,
"item_category": "Footwear",
"item_brand": "Nike"
},
{
"item_id": "SKU-67890",
"item_name": "Sports Socks",
"price": 15.00,
"quantity": 2,
"item_category": "Accessories"
}
],
"params": {
"fbp": "fb.1.1234567890.987654321",
"fbc": "fb.1.1234567890.AbCdEfGhIjKl"
}
}'
Server-Side (Python)
import os
import requests
from flask import request
secret_key = os.environ.get('AXITRACE_SECRET_KEY')
# Read AxiTrace SDK cookies
visitor_id = request.cookies.get('vt_vid')
session_id = request.cookies.get('vt_sid')
fbp = request.cookies.get('_fbp')
fbc = request.cookies.get('_fbc')
# Track payment info added
requests.post(
'https://stat.axitrace.com/v1/checkout/add_payment_info',
auth=(secret_key, ''),
json={
'client_id': visitor_id,
'session_id': session_id,
'email': 'customer@example.com',
'phone': '+1-555-123-4567',
'currency': 'USD',
'value': 129.99,
'payment_type': 'credit_card',
'coupon': 'SAVE10',
'items': [{
'item_id': 'SKU-12345',
'item_name': 'Blue Running Shoes',
'price': 99.99,
'quantity': 1,
}],
'params': {
'fbp': fbp,
'fbc': fbc,
}
}
)
Response
Success Response (200 OK)
{
"success": true,
"eventId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"action": "add_payment_info"
}
Error Responses
| Status | Error | Description |
|---|---|---|
400 |
at least one of client_id, user_id, or session_id is required |
No user identifier provided |
400 |
currency, value >= 0, and items are required |
Missing currency, negative value, or empty items array |
401 |
unauthorized |
Invalid or missing API key |
Best Practices
- Always include email (server-side) — At checkout, you have the customer's email. Including it as a top-level field significantly improves Facebook CAPI match quality (up to 41%). This is the main advantage of server-side tracking for checkout events.
- Include payment_type — Track which payment methods your customers prefer for analytics and optimization
- Choose one approach per event — Use either the JS SDK or the server-side API for each add-payment-info action, never both (avoids double-counting)
- Link to browser session (server-side) — When using the PHP SDK, pass browser cookie values (
vt_vid,vt_sid,_fbp,_fbc) for proper attribution and deduplication - Use consistent item_id — Match the
item_idused inproduct.addToCartandbegin_checkoutfor funnel analysis