Create Auto Attempt
Create an automatic payment attempt using previously stored payment credentials without requiring customer interaction.
Endpoint
POST /api/intents/auto-attempt
Authentication: Required (API Key)
Description
This endpoint allows you to initiate payments on behalf of your customers without requiring any action from them. This functionality is particularly useful for collecting recurring payments (subscriptions), automatic top-ups, or other automated billing processes where customer interaction is not needed.
How It Works
- The endpoint creates a new payment intent in non-interactive mode
- It uses previously stored payment credentials to process the payment
- No customer action or redirection is required - the payment attempt is processed automatically
Prerequisites
Before initiating an automatic payment attempt, the following conditions must be met:
1. Prior Successful Payment
The customer must have completed a previous successful payment where:
allow_remember_credentialswas set totrue- Either
request_unscheduled_mitorrequire_unscheduled_mitwas set totrue
2. Valid Stored Credential
You must provide a valid credential token that:
- Was generated from a previous successful payment
- Uses a payment method that supports MIT (Merchant-Initiated Transactions)
3. Obtaining Credential Tokens
The credential tokens required for auto-payments are provided in webhook notifications after a successful payment. When a customer completes a payment with allow_remember_credentials=true and the appropriate MIT settings, your system will receive a webhook notification containing the credential token.
Request
Headers
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | string | Yes | Bearer token with your API key |
Content-Type | string | Yes | Must be application/json |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
amount | integer | Yes | Amount in minor units (cents). E.g., 1000 = $10.00 |
currency | string | Yes | ISO 4217 currency code (e.g., USD, ZAR, EUR) |
reference_id | string | Yes | Your unique transaction reference |
purchaser_id | string (min 3 chars) | Yes | Your unique customer identifier (must match credential) |
credentials | array of strings | Yes | Array containing the credential token(s) to use |
purchaser_info | object | No | Customer details (email, phone, country, locale) |
split | object | No | Payment split configuration for multiple beneficiaries |
Purchaser Info Object
| Field | Type | Required | Description |
|---|---|---|---|
email | string | No | Customer email address |
phone_number | string | No | Customer phone number |
country | string | No | ISO country code (e.g., ZA) |
locale | string | No | Locale code (e.g., en-ZA) |
Split Object
| Field | Type | Required | Description |
|---|---|---|---|
split_type | string | Yes | Currently only AMOUNT supported |
splits | array (min 2) | Yes | List of beneficiary splits |
description | string | No | Optional split description |
See Split Payouts Guide for details.
Example Request
curl -X POST https://app.infinic.com/api/intents/auto-attempt \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 5000,
"currency": "ZAR",
"reference_id": "subscription_payment_456",
"purchaser_id": "customer_abc",
"credentials": ["luUOJ4pNipy3vdGPSD"],
"purchaser_info": {
"email": "customer@example.com",
"phone_number": "+27123456789"
}
}'
const response = await fetch(
"https://app.infinic.com/api/intents/auto-attempt",
{
method: "POST",
headers: {
Authorization: `Bearer ${YOUR_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
amount: 5000,
currency: "ZAR",
reference_id: "subscription_payment_456",
purchaser_id: "customer_abc",
credentials: ["luUOJ4pNipy3vdGPSD"],
purchaser_info: {
email: "customer@example.com",
phone_number: "+27123456789",
},
}),
},
);
const data = await response.json();
console.log("Auto attempt created:", data);
import requests
response = requests.post(
'https://app.infinic.com/api/intents/auto-attempt',
headers={
'Authorization': f'Bearer {YOUR_API_KEY}',
'Content-Type': 'application/json'
},
json={
'amount': 5000,
'currency': 'ZAR',
'reference_id': 'subscription_payment_456',
'purchaser_id': 'customer_abc',
'credentials': ['luUOJ4pNipy3vdGPSD'],
'purchaser_info': {
'email': 'customer@example.com',
'phone_number': '+27123456789'
}
}
)
data = response.json()
print('Auto attempt created:', data)
Response
Success Response (201 Created)
{
"id": 12345,
"attempt_status": "pending",
"method": "card",
"failure_reason": null,
"intent_id": "550e8400-e29b-41d4-a716-446655440000",
"intent_status": "pending",
"action": null,
"redirect_url": null
}
| Field | Type | Description |
|---|---|---|
id | integer | Unique payment attempt identifier |
attempt_status | string | Status of the attempt (initiated, pending, success) |
method | string | Payment method used (e.g., card, paypal) |
failure_reason | string / null | Reason for failure (null if successful or pending) |
intent_id | string (UUID) | Associated payment intent ID |
intent_status | string | Status of the intent (pending, success, failed) |
action | object / null | Additional action required (usually null for auto) |
redirect_url | string / null | Redirect URL (usually null for non-interactive) |
Error Responses
401 Unauthorized
{
"detail": "Invalid or missing API key"
}
Causes:
- Missing Authorization header
- Invalid API key
- Using sandbox key with production URL (or vice versa)
403 Forbidden
{
"detail": "Not authorized to use the provided credential"
}
Causes:
- Credential belongs to different merchant
- Credential was created by different merchant
404 Not Found
{
"detail": "Credential not found"
}
Causes:
- Invalid credential token
- Credential has been deleted
- Credential does not exist
422 Validation Error
{
"detail": "Credential exists but cannot be used for MIT transactions"
}
Causes:
- Credential is not MIT compatible
- Payment method doesn't support merchant-initiated transactions
- Original payment was not set up for auto-payments
Other validation errors:
{
"detail": [
{
"loc": ["body", "amount"],
"msg": "ensure this value is greater than or equal to 0",
"type": "value_error"
}
]
}
Monitoring Payment Status
After creating an auto payment attempt, you can check its status using:
- GET
/api/intents/{intent_id}?iauth={token}- Use the intent token (iauth) as a query parameter, or the API key in the Authorization header - The response includes the current intent status, attempt details, and transaction information
Important Notes
Payment Method Support
Not all payment methods support MIT (Merchant-Initiated Transactions). The is_mit_compatible flag in the credential indicates whether it can be used for auto-payments.
Status Transitions
Auto payments follow the same status transitions as regular payments:
- initiated → Payment attempt created
- pending → Being processed by payment provider
- success → Payment completed successfully
- failed → Payment failed (intent goes directly to Failed since no user interaction is possible)
Failed Payments
If an auto payment fails, the intent will go directly to Failed state since no user interaction is possible to retry with a different payment method.
Security
- Always store credential tokens securely (encrypted at rest)
- Never expose credential tokens in client-side code
- Validate the purchaser_id matches the credential owner
- Implement rate limiting to prevent abuse
Use Cases
- Subscription Billing - Charge customers on a recurring schedule
- Automatic Top-ups - Refill customer accounts when balance is low
- Deferred Payments - Charge customers after service delivery
- Split Payments - Charge remaining balance after initial payment
- Penalty Fees - Apply late fees or other charges automatically
Next Steps
After creating an auto attempt:
- Monitor webhook events for payment status updates
- Handle failed payments appropriately (retry logic, customer notification)
- Update your system with payment results