Switch Gateway
Override the payment gateway on a per-session basis for A/B testing or routing.
curl -X POST "https://api.catalystpay.com/api/v1/payment-sessions/" \
-H "Authorization: Bearer rk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"campaign_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"gateway_id": "f7e8d9c0-b1a2-3456-cdef-890123456789",
"lead": {
"first_name": "Max",
"last_name": "Mustermann",
"email": "[email protected]",
"country": "DE"
}
}'
import requests
response = requests.post(
"https://api.catalystpay.com/api/v1/payment-sessions/",
headers={"Authorization": "Bearer rk_your_api_key"},
json={
"campaign_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"gateway_id": "f7e8d9c0-b1a2-3456-cdef-890123456789",
"lead": {
"first_name": "Max",
"last_name": "Mustermann",
"email": "[email protected]",
"country": "DE",
},
},
)
session = response.json()
print(session["payment_url"])
const response = await fetch(
'https://api.catalystpay.com/api/v1/payment-sessions/',
{
method: 'POST',
headers: {
'Authorization': 'Bearer rk_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
campaign_id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
gateway_id: 'f7e8d9c0-b1a2-3456-cdef-890123456789',
lead: {
first_name: 'Max',
last_name: 'Mustermann',
email: '[email protected]',
country: 'DE',
},
}),
}
);
const session = await response.json();
console.log(session.payment_url);
Response:
{
"session_token": "ps_abc123def456...",
"status": "PENDING",
"payment_url": "https://pay.catalystpay.com/s/ps_abc123def456..."
}
The gateway_id must reference an active PaymentGateway within your tenant. In direct mode (no campaign_id), gateway_id is required. You can combine gateway_id with pricing overrides in the same request. See How to Switch Gateways for the full guide.