Initiating a Subscription
Method 1: Checkout Flow (Recommended)
The simplest way to initiate a subscription. Create a checkout session and redirect the customer.
From the Dashboard
- Go to Subscriptions > select an offer.
- Click Initiate Subscription.
- The customer is sent to the hosted checkout page.
Via the API
curl -X POST https://api.inflowpay.xyz/subscription/offer/{offerId}/initiate \
-H "X-Inflow-Api-Key: your_private_key" \
-H "Content-Type: application/json" \
-d '{
"customerEmail": "[email protected]",
"successUrl": "https://yoursite.com/welcome",
"cancelUrl": "https://yoursite.com/pricing",
"metadatas": {
"userId": "usr_123",
"plan": "pro"
}
}'Request Body
| Field | Type | Required | Description |
|---|---|---|---|
customerEmail | string | No | Pre-fill the customer's email |
successUrl | string | No | Redirect after successful payment |
cancelUrl | string | No | Redirect if customer cancels |
metadatas | object | No | Custom key-value data |
guestId | string | No | Guest identifier |
paymentMethodRef | string | No | Payment method reference (for waitlist-enabled offers) |
Response
{
"subscriptionId": "sub_abc123",
"paymentId": "pay_abc123",
"purchaseUrl": "https://checkout.inflowpay.com/..."
}Redirect the customer to the purchaseUrl to complete the checkout.
Method 2: Server-to-Server
For direct card processing without redirecting the customer. Requires PCI-compliant infrastructure.
Important: Server-to-server integration requires sending card details to
https://api-card.inflowpay.com, not the standard API URL.
curl -X POST https://api-card.inflowpay.com/subscription/offer/{offerId}/initiate-server \
-H "X-Inflow-Api-Key: your_private_key" \
-H "Content-Type: application/json" \
-d '{
"customerEmail": "[email protected]",
"billingCountry": "FR",
"purchasingAsBusiness": false,
"firstName": "John",
"lastName": "Doe",
"card": {
"number": "4242424242424242",
"expMonth": 12,
"expYear": 2027,
"cvc": "123"
},
"autoConfirm": true,
"metadatas": {
"userId": "usr_123"
}
}'Request Body
All fields from the checkout flow plus:
| Field | Type | Required | Description |
|---|---|---|---|
customerEmail | string | Yes | Customer email |
billingCountry | string | Yes | ISO 3166-1 alpha-2 country code |
purchasingAsBusiness | boolean | Yes | Business purchase flag |
businessName | string | If business | Business name |
taxId | string | If business | Business tax ID |
postalCode | string | If US | Billing postal code |
firstName | string | No | Customer first name (recommended for 3DS) |
lastName | string | No | Customer last name (recommended for 3DS) |
savePaymentMethod | boolean | No | Save the card for future charges (default: false). For subscriptions, the card is typically saved automatically for renewals. Use this when you want to explicitly control saving. |
useCustomerPaymentMethod | boolean | No | Use the customer's last saved payment method (default: false). Use when the customer already has a card on file. |
card | object | No | Card details (number, expMonth, expYear, cvc) |
autoConfirm | boolean | No | Process immediately if no 3DS required |
pricingMode | string | No | TAX_EXCLUSIVE or TAX_INCLUSIVE |
metadatas | object | No | Custom metadata |
Response
{
"payment": {
"id": "pay_abc123",
"status": "INITIATION",
"amountInCents": 2999,
"currency": "EUR"
},
"threeDsSessionUrl": null
}If threeDsSessionUrl is not null, redirect the customer to complete 3D Secure authentication.
Saving and reusing payment methods for subscriptions
savePaymentMethod: true— Saves the card for future subscription charges. For most subscriptions, the card is saved automatically for renewals.useCustomerPaymentMethod: true— Uses the customer's last saved card. Use when the customer already has a card on file (e.g. from a previous subscription or payment). The customer must be identified by the samecustomerEmail.
You cannot use both in the same request. If the customer has no saved card yet, useCustomerPaymentMethod: true will fail.
After Initiation
- Waitlist enabled: The subscription enters
pending_waitliststatus. You must approve it from the Dashboard. - Trial period: The subscription becomes
ACTIVEimmediately, but the first charge happens after the trial ends. - Entry fee: The first payment uses the entry fee amount; subsequent payments use the regular amount.
- Standard: The customer is charged immediately and the subscription becomes
ACTIVE.
Updated 1 day ago