Recurring Payments
Create a Recurring Payment
Endpoint: Create Recurring Payment
POST https://api.xendit.co/recurring_payments
Recurring payments allow you to automatically bill your customers using our system.
Request Parameters
Example: Create Recurring Request
curl https://api.xendit.co/recurring_payments -X POST \
-u xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==: \
-d external_id=recurring_31451441 \
-d payer_email=sample_email@xendit.co \
-d interval=MONTH \
-d interval_count=1 \
-d description='Monthly room cleaning service' \
-d amount=125000
<?php
use Xendit\Xendit;
require 'vendor/autoload.php';
Xendit::setApiKey('xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==');
$params = [
'external_id' => 'recurring_31451441',
'payer_email' => 'sample_email@xendit.co',
'description' => 'Monthly room cleaning service',
'amount' => 125000,
'interval' => 'MONTH',
'interval_count' => 1
];
$createRecurring = \Xendit\Recurring::create($params);
var_dump($createRecurring);
?>
const x = new require('xendit-node')({ secretKey: 'xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==' });
const { RecurringPayment } = x;
const rpSpecificOptions = {};
const rp = new RecurringPayment(rpSpecificOptions);
const resp = await rp.createPayment({
externalID: 'recurring_31451441',
amount: 125000,
payerEmail: 'sample_email@xendit.co',
interval: RecurringPayment.Interval.Month,
intervalCount: 1,
description: 'Monthly room cleaning service',
});
console.log(resp);
Xendit.apiKey = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==";
try {
Map<String , Object> params = new HashMap<>();
params.put("external_id", "recurring_31451441");
params.put("payer_email", "sample_email@xendit.co");
params.put("interval", "MONTH");
params.put("interval_count", 1);
params.put("description", "Monthly room cleaning service");
params.put("amount", 125000);
RecurringPayment recurringPayment = RecurringPayment.create(params);
} catch (XenditException e) {
e.printStackTrace();
}
xendit.Opt.SecretKey = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
createData := recurringpayment.CreateParams{
ExternalID: "recurring_31451441",
Amount: 125000,
PayerEmail: "sample_email@xendit.co",
Description: "Monthly room cleaning service",
Interval: xendit.RecurringPaymentIntervalDay,
IntervalCount: 1,
}
resp, err := recurringpayment.Create(&createData)
if err != nil {
log.Fatal(err)
}
fmt.Printf("created recurring payment: %+v\n", resp)
from xendit import Xendit
api_key = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
xendit_instance = Xendit(api_key=api_key)
RecurringPayment = xendit_instance.RecurringPayment
recurring_payment = RecurringPayment.create(
external_id="recurring_12345",
payer_email="test@x.co",
description="Test Curring Payment",
amount=100000,
interval="MONTH",
interval_count=1,
)
print(recurring_payment)
Header Parameter | Type | Description |
---|---|---|
for-user-idoptional |
string |
The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information |
Body Parameter | Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
external_id required |
string |
ID of your choice (typically the unique identifier of a recurring payment in your system) | ||||||||
amount required |
number |
Amount per invoice per interval. The minimum amount to create an invoice is 1 IDR. The maximum amount is 1.000.000.000 IDR |
||||||||
interval required |
string |
One of DAY , WEEK , MONTH . The frequency with which a recurring payment invoice should be billed. |
||||||||
interval_count required |
number |
The number of intervals (specified in the interval property) between recurring. For example, interval=MONTH and interval_count=3 bills every 3 months. | ||||||||
payer_email optional |
string |
Email of the end customer you are charging WILL BE DEPRECATED SOON. If you wish to send email notifications to your end users, please provide values in the customer object. |
||||||||
description optional |
string |
Description of invoice - you can use this field to list what items are being paid for, or anything else of your choice that describes the function of the invoice. | ||||||||
total_recurrence optional |
number |
The number of times you will charge your customer. If you input it as 3, Xendit will charge your customer 3 times. If you input total_recurrence as 3, interval_count as 1 and interval as "DAY", Xendit will charge customer 3 times in first day after you trigger create recurring api, the day after and 2 days after you trigger create recurring api. | ||||||||
invoice_duration optional |
number |
duration of time that end user have in order to pay the invoice before it's expired (in Second). If it's not filled, invoice_duration will follow your business default invoice duration. invoice_duration should and will always be less than the interval-interval_count combination. |
||||||||
should_send_email optionaldefault:
|
boolean |
Choose whether you want us to email your end customer when an invoice is created, paid, or expired WILL BE DEPRECATED SOON. If you wish to send email notifications to your end users, please provide values in the customer-notification-preference object. |
||||||||
customer optional |
object |
Object containing customer’s details. Customer’s Email & mobile number need to be included in this object for sending email/SMS/WhatsApp notifications.
|
||||||||
customer_notification_preference optional |
object |
Object containing notification preferences for the invoice. If you wish to send notifications and reminders to your end customer, please populate the values in this object.
|
||||||||
reminder_time_unit optional |
string |
The frequency of the recurring reminder to your customer. The value can be either days or hours Default value will be using user Invoice Settings from the Dashboard |
||||||||
reminder_time optional |
number |
Send a reminder notification to your customer before invoice expires. Allowed values are number between 1 to 30 for days and 1 to 24 for hours. Example: When reminder time value is set to 1 hour, a reminder notification will be sent to your customer 1 hour before the Invoice expires Default value will be using user Invoice Settings from the Dashboard |
||||||||
missed_payment_action optionaldefault:
|
string |
One of IGNORE , STOP . If there is an invoice from a recurring payment that expired, IGNORE will continue with the recurring payment as usual. STOP will stop the recurring payment. |
||||||||
credit_card_token optional |
string |
Token ID for credit card autocharge. If it's empty then the autocharge is disabled. This token must be multiple use (is_multiple_use is true). please refer create cards token on how to create multi-use token. The token will still be there even if it's failed to charge. |
||||||||
start_date optional |
string (ISO 8601) |
time when the first invoice will be issued. When left blank, the invoice will be created immediately | ||||||||
success_redirect_url optional |
string |
url that end user will be redirected to upon successful payment to invoice created by this recurring payment. example : https://yourcompany.com/example_item/10/success_page |
||||||||
failure_redirect_url optional |
string |
url that end user will be redirected to upon expireation of invoice created by this recurring payment. example : https://yourcompany.com/example_item/10/failed_checkout |
||||||||
recharge optionaldefault:
|
boolean |
Input this parameter as true when you want to enable auto-charged and capture card information through XenInvoice. |
||||||||
charge_immediately optional |
boolean |
Specify should the first invoice created immediately when creating recurring payment with a valid start_date , The next invoice will be created at start_date and the calculation for the following recurring invoice will be at interval *interval_count + start_date |
||||||||
payment_method_id optional |
string |
ID of direct debit token (called payment_method) created for this customer | ||||||||
currency optional |
string |
Currency of the amount that you created example : "IDR" |
Response Parameters
Example: Create Recurring Response
{
"id": "579c8d61f23fa4ca35e52da3",
"user_id": "5781d19b2e2385880609791c",
"external_id": "recurring_31451441",
"status": "ACTIVE",
"amount": 125000,
"payer_email": "sample_email@xendit.co",
"description": "Monthly room cleaning service",
"interval": "MONTH",
"interval_count": 1,
"recurrence_progress": 1,
"should_send_email": false,
"missed_payment_action": "IGNORE",
"last_created_invoice_url": "https://invoice-staging.xendit.co/web/invoices/5dddeea6bdb99f4b23e5eef7",
"created": "2017-06-12T14:00:00.306Z",
"updated": "2017-06-12T14:00:00.306Z",
"start_date": "2017-07-12T14:00:00.306Z",
"recharge": true
}
Parameter | Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
id | An recurring ID generated by Xendit | |||||||||
user_id | Your Xendit Business ID | |||||||||
external_id | The recurring ID in your server, that can be used to reconcile between you and Xendit | |||||||||
status | ACTIVE the recurring payment is currently activeSTOPPED the recurring payment has been stoppedPAUSED the recurring payment is currently paused and will not automatically creating invoices. resume to reactivate |
|||||||||
amount | Nominal amount of the recurring payment in IDR | |||||||||
payer_email | Email of the payer, we get this information from your API call | |||||||||
description | Description for the recurring payment and invoices | |||||||||
should_send_email | boolean |
Shows whether you will send email notifications for invoice WILL BE DEPRECATED SOON. If you wish to send email notifications to your end users, please provide values in the |
||||||||
customer | object |
Object containing customer’s details. Customer’s Email & mobile number need to be included in this object for sending email/SMS/WhatsApp notifications.
|
||||||||
customer_notification_preference | object |
Object containing notification preferences for the invoice. If you wish to send notifications and reminders to your end customer, please populate the values in this object.
|
||||||||
reminder_time_unit | string |
The frequency of the recurring reminder to your customer. The value can be either days or hours |
||||||||
reminder_time | number |
Send a reminder notification to your customer before invoice expires. Allowed values are number between 1 to 30 for days and 1 to 24 for hours . |
||||||||
interval | One of DAY , WEEK , MONTH . The frequency with which a recurring payment invoice should be billed. |
|||||||||
interval_count | The number of intervals (specified in the interval property) between recurring. For example, interval=MONTH and interval_count=3 bills every 3 months. | |||||||||
total_recurrence | The number of times you will charge your customer. If you input it as 3, Xendit will charge your customer 3 times. If you input total_recurrence as 3, interval_count as 1 and interval as "DAY", Xendit will charge customer 3 times in first day after you trigger create recurring api, the day after and 2 days after you trigger create recurring api. | |||||||||
recurrence_progress | The current cycle of recurring payment. If your end customer is on the 4th cycle of the recurring, you will get 4 from recurrence_progress response | |||||||||
last_created_invoice_url | url leading to the last invoice create by this recurring payment | |||||||||
credit_card_token | Token ID for credit card autocharge. If it's empty then the autocharge is disabled. This token must be multiple use (is_multiple_use is true). please refer create cards token on how to create multi-use token. The token will still be there even if it's failed to charge. |
|||||||||
success_redirect_url optional |
string |
url that end user will be redirected to upon successful payment to invoice created by this recurring payment. example : https://yourcompany.com/example_item/10/success_page |
||||||||
failure_redirect_url optional |
string |
url that end user will be redirected to upon expireation of invoice created by this recurring payment. example : https://yourcompany.com/example_item/10/failed_checkout |
||||||||
invoice_duration optional |
number |
duration of time that end user have in order to pay the invoice before it's expired (in Second). invoice_duration should and will always be less than the interval-interval_count combination. |
||||||||
created | An ISO timestamp that tracks when the recurring payment was created | |||||||||
updated | An ISO timestamp that tracks when the recurring payment was updated | |||||||||
charge_immediately optional |
boolean |
A flag showing should the first invoice created immediately when creating recurring payment with a valid start_date |
||||||||
recharge | When this parameter is true , it means you want to enable auto-charged and capture card information through XenInvoice. |
|||||||||
payment_method_id | ID of direct debit token (called payment_method) bound to this recurring payment | |||||||||
currency optional |
string |
Currency of the amount that you created |
Error Codes
Error Code | Description |
---|---|
API_VALIDATION_ERROR400 |
Inputs are failing validation. The errors field contains details about which fields are violating validation. |
INVALID_JSON_FORMAT400 |
The request body is not a valid JSON format. |
INVALID_CREDIT_CARD_TOKEN_ERROR400 |
Credit Card token is invalid. |
INVALID_PAYMENT_METHOD_ID_ERROR400 |
Payment method id is invalid. |
REQUEST_FORBIDDEN403 |
API key in use does not have necessary permissions to perform the request. Please assign proper permissions for the key. Learn more here |
UNSUPPORTED_CURRENCY400 |
The currency is not configured yet in the settings, please contact us. |
Get a Recurring Payment
Endpoint: Get a Recurring Payment
GET https://api.xendit.co/recurring_payments/{id}
Request Parameters
Example Get Recurring Payment Request
curl https://api.xendit.co/recurring_payments/{id} \
-X GET \
-u xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==:
<?php
use Xendit\Xendit;
require 'vendor/autoload.php';
Xendit::setApiKey('xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==');
$id = '579c8d61f23fa4ca35e52da3';
$getRecurring = \Xendit\Recurring::retrieve($id);
var_dump($getRecurring);
?>
const x = new require('xendit-node')({ secretKey: 'xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==' });
const { RecurringPayment } = x;
const rpSpecificOptions = {};
const rp = new RecurringPayment(rpSpecificOptions);
const resp = await rp.getPayment({ id: '579c8d61f23fa4ca35e52da3' });
console.log(resp);
Xendit.apiKey = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==";
try {
RecurringPayment recurringPayment = RecurringPayment.get("EXAMPLE_ID");
} catch (XenditException e) {
e.printStackTrace();
}
xendit.Opt.SecretKey = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
getData := recurringpayment.GetParams{
ID: "579c8d61f23fa4ca35e52da3",
}
resp, err := recurringpayment.Get(&getData)
if err != nil {
log.Fatal(err)
}
fmt.Printf("retrieved recurring payment: %+v\n", resp)
from xendit import Xendit
api_key = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
xendit_instance = Xendit(api_key=api_key)
RecurringPayment = xendit_instance.RecurringPayment
recurring_payment = RecurringPayment.get(
id="5f05825ff9f52d3ed204c687",
)
print(recurring_payment)
Header Parameter | Type | Description |
---|---|---|
for-user-idoptional |
string |
The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information |
Path Parameter | Type | Description |
---|---|---|
id required |
string |
ID of the recurring payment to retrieve |
Response Parameters
Example Get Recurring Payment Response
{
"id": "579c8d61f23fa4ca35e52da3",
"user_id": "5781d19b2e2385880609791c",
"external_id": "recurring_31451441",
"status": "ACTIVE",
"amount": 125000,
"payer_email": "sample_email@xendit.co",
"description": "Monthly room cleaning service",
"interval": "MONTH",
"interval_count": 1,
"recurrence_progress": 1,
"should_send_email": true,
"missed_payment_action": "IGNORE",
"last_created_invoice_url": "https://invoice-staging.xendit.co/web/invoices/5dddeea6bdb99f4b23e5eef7",
"created": "2017-06-12T14:00:00.306Z",
"updated": "2018-06-12T14:00:00.306Z",
"start_date": "2017-07-12T14:00:00.306Z",
"recharge":true
}
Parameter | Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
id | An recurring ID generated by Xendit | |||||||||
user_id | Your Xendit Business ID | |||||||||
external_id | The recurring ID in your server, that can be used to reconcile between you and Xendit | |||||||||
status | ACTIVE the recurring payment is currently activeSTOPPED the recurring payment has been stoppedPAUSED the recurring payment is currently paused and will not automatically creating invoices. resume to reactivate |
|||||||||
amount | Nominal amount of the recurring payment | |||||||||
payer_email | Email of the payer, we get this information from your API call | |||||||||
description | Description for the recurring payment and invoices | |||||||||
should_send_email | boolean |
Shows whether you will send email notifications for invoice WILL BE DEPRECATED SOON. If you wish to send email notifications to your end users, please provide values in the |
||||||||
customer | object |
Object containing customer’s details. Customer’s Email & mobile number need to be included in this object for sending email/SMS/WhatsApp notifications.
|
||||||||
customer_notification_preference | object |
Object containing notification preferences for the invoice. If you wish to send notifications and reminders to your end customer, please populate the values in this object.
|
||||||||
reminder_time_unit | string |
The frequency of the recurring reminder to your customer. The value can be either days or hours |
||||||||
reminder_time | number |
Send a reminder notification to your customer before invoice expires. Allowed values are number between 1 to 30 for days and 1 to 24 for hours . |
||||||||
interval | One of DAY , WEEK , MONTH . The frequency with which a recurring payment invoice should be billed. |
|||||||||
interval_count | number |
The number of intervals (specified in the interval property) between recurring. For example, interval=MONTH and interval_count=3 bills every 3 months. | ||||||||
total_recurrence | The number of times you will charge your customer. If you input it as 3, Xendit will charge your customer 3 times. If you input total_recurrence as 3, interval_count as 1 and interval as "DAY", Xendit will charge customer 3 times in first day after you trigger create recurring api, the day after and 2 days after you trigger create recurring api. | |||||||||
recurrence_progress | The current cycle of recurring payment. If your end customer is on the 4th cycle of the recurring, you will get 4 from recurrence_progress response | |||||||||
last_created_invoice_url | url leading to the last invoice create by this recurring payment | |||||||||
credit_card_token | Token ID for credit card autocharge. If it's empty then the autocharge is disabled. This token must be multiple use (is_multiple_use is true). please refer invoice callback on how to create multi-use token. The token will still be there even if it's failed to charge. |
|||||||||
success_redirect_url optional |
string |
url that end user will be redirected to upon successful payment to invoice created by this recurring payment. example : https://yourcompany.com/example_item/10/success_page |
||||||||
failure_redirect_url optional |
string |
url that end user will be redirected to upon expireation of invoice created by this recurring payment. example : https://yourcompany.com/example_item/10/failed_checkout |
||||||||
invoice_duration optional |
number |
duration of time that end user have in order to pay the invoice before it's expired (in Second). | ||||||||
next_scheduled_at |
An ISO timestamp of when the next invoice will be issued | |||||||||
created | An ISO timestamp that tracks when the recurring payment was created | |||||||||
updated | An ISO timestamp that tracks when the recurring payment was updated | |||||||||
charge_immediately optional |
boolean |
A flag showing should the first invoice created immediately when creating recurring payment with a valid start_date |
||||||||
recharge | When this parameter is true , it means you want to enable auto-charged and capture card information through XenInvoice. |
Error Codes
Error Code | Description |
---|---|
REQUEST_FORBIDDEN403 |
API key in use does not have necessary permissions to perform the request. Please assign proper permissions for the key. Learn more here |
NOT_FOUND_ERROR404 |
Could not find recurring by id. |
Edit Recurring Payment
Endpoint: Edit Recurring Payment
PATCH https://api.xendit.co/recurring_payments/{id}
Request Parameters
Example: Edit Recurring Payment Request
curl https://api.xendit.co/recurring_payments/579c8d61f23fa4ca35e52da3 \
-X PATCH \
-u xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==: \
-d amount=80000 \
-d interval=WEEK \
-d interval_count=2 \
-d should_send_email=true \
-d missed_payment_action=STOP \
-d credit_card_token=522f0ba2ab70de5d2b409eee \
<?php
use Xendit\Xendit;
require 'vendor/autoload.php';
Xendit::setApiKey('xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==');
$id = '579c8d61f23fa4ca35e52da3';
$params = ['amount' => 80000];
$editRecurring = \Xendit\Recurring::update($id, $params);
var_dump($editRecurring);
?>
const x = new require('xendit-node')({ secretKey: 'xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==' });
const { RecurringPayment } = x;
const rpSpecificOptions = {};
const rp = new RecurringPayment(rpSpecificOptions);
const resp = await rp.editPayment({
id: '579c8d61f23fa4ca35e52da3',
amount: 80000,
interval: RecurringPayment.Interval.Week,
intervalCount: 2,
shouldSendEmail: true,
missedPaymentAction: RecurringPayment.Action.Stop,
creditCardToken: '522f0ba2ab70de5d2b409eee',
});
console.log(resp);
Xendit.apiKey = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==";
try {
Map<String, Object> params = new HashMap<>();
params.put("amount", 80000);
params.put("interval", "WEEK");
RecurringPayment recurringPayment = RecurringPayment.edit("EXAMPLE_ID", params);
} catch (XenditException e) {
e.printStackTrace();
}
xendit.Opt.SecretKey = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
editData := recurringpayment.EditParams{
ID: "579c8d61f23fa4ca35e52da3",
Amount: 80000,
Interval: xendit.RecurringPaymentIntervalWeek,
IntervalCount: 2,
}
resp, err := recurringpayment.Edit(&editData)
if err != nil {
log.Fatal(err)
}
fmt.Printf("edited recurring payment: %+v\n", resp)
from xendit import Xendit
api_key = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
xendit_instance = Xendit(api_key=api_key)
RecurringPayment = xendit_instance.RecurringPayment
recurring_payment = RecurringPayment.edit(
id="5f05825ff9f52d3ed204c687",
interval_count=2,
)
print(recurring_payment)
Header Parameter | Type | Description |
---|---|---|
for-user-idoptional |
string |
The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information |
Path Parameter | Type | Description |
---|---|---|
idrequired |
string |
id of recurring you want to update |
Body Parameter | Type | Description |
---|---|---|
amountoptional |
number |
Edit amount per invoice per interval. The minimum amount to create an invoice is 10.000 IDR. The maximum amount is 1.000.000.000 IDR< |
credit_card_token optional |
string |
Multi use token ID for credit card autocharge. If it's empty then the autocharge is disabled. The token will still be there even if it's failed to charge |
interval optional |
string |
Edit the frequency with which a recurring payment invoice should be billed. One of DAY , WEEK , MONTH . |
interval_count optional |
number |
Edit the number of intervals (specified in the interval property) between recurring. For example, interval=MONTH and interval_count=3 bills every 3 months. |
should_send_email optional |
boolean |
Edit whether the end user get email when invoice is created, paid, or expired; or not |
invoice_duration optional |
number |
duration of time that end user have in order to pay the invoice before it's expired (in Second). If it's not filled, invoice_duration will follow your business default invoice duration. invoice_duration should and will always be less than the interval-interval_count combination. |
reschedule_at optional |
string (ISO 8601) |
Time when the next invoice will be issued. If left blank, the invoice will be issued based on previous recurring payment settings. |
missed_payment_action optional |
string |
Edit action if there is an invoice from a recurring payment that expired, IGNORE will continue with the recurring payment as usual. STOP will stop the recurring payment. |
payment_method_id optional |
string |
Fill this with the direct debit token (called) created for this end customer |
customer_id optional |
string |
fill this with customer id that you want to assign the recurring payment to |
reminder_time_unit optional |
string |
The frequency of the recurring reminder to your customer. The value can be either days or hours Default value will be using user Invoice Settings from the Dashboard |
reminder_time optional |
number |
Send a reminder notification to your customer before invoice expires. Allowed values are number between 1 to 30 for days and 1 to 24 for hours. Example: When reminder time value is set to 1 hour, a reminder notification will be sent to your customer 1 hour before the Invoice expires Default value will be using user Invoice Settings from the Dashboard |
Response Parameters
Example: Edit Recurring Payment Response
{
"id": "579c8d61f23fa4ca35e52da3",
"user_id": "5781d19b2e2385880609791c",
"external_id": "recurring_31451441",
"status": "ACTIVE",
"amount": 80000,
"payer_email": "sample_email@xendit.co",
"description": "Monthly room cleaning service",
"interval": "WEEK",
"interval_count": 2,
"recurrence_progress": 1,
"should_send_email": true,
"recharge": true,
"missed_payment_action": "STOP",
"created": "2017-06-12T14:00:00.306Z",
"updated": "2017-06-12T14:00:00.306Z",
"start_date": "2017-06-19T14:00:00.306Z"
}
All response parameters will be the same as get recurring
Error Codes
Error Code | Description |
---|---|
NOT_FOUND_ERROR404 |
Could not find recurring by id. |
API_VALIDATION_ERROR400 |
Inputs are failing validation. The errors field contains details about which fields are violating validation. |
INVALID_JSON_FORMAT400 |
The request body is not a valid JSON format. |
INVALID_CREDIT_CARD_TOKEN_ERROR400 |
Credit card token is invalid. |
INVALID_PAYMENT_METHOD_ID_ERROR400 |
Payment method id is invalid. |
REQUEST_FORBIDDEN403 |
API key in use does not have necessary permissions to perform the request. Please assign proper permissions for the key. Learn more here |
Stop Recurring Payment
Endpoint: Stop Recurring
POST https://api.xendit.co/recurring_payments/{id}/stop!
Request Parameters
Example: Stop Recurring Payment Request
curl https://api.xendit.co/recurring_payments/{id}/stop! -X POST \
-u xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==:
<?php
use Xendit\Xendit;
require 'vendor/autoload.php';
Xendit::setApiKey('xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==');
$id = '579c8d61f23fa4ca35e52da3';
$stopRecurring = \Xendit\Recurring::stop($id);
var_dump($stopRecurring);
?>
const x = new require('xendit-node')({ secretKey: 'xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==' });
const { RecurringPayment } = x;
const rpSpecificOptions = {};
const rp = new RecurringPayment(rpSpecificOptions);
const resp = await rp.stopPayment({ id: '579c8d61f23fa4ca35e52da3' });
console.log(resp);
Xendit.apiKey = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==";
try {
RecurringPayment recurringPayment = RecurringPayment.stop("EXAMPLE_ID");
} catch (XenditException e) {
e.printStackTrace();
}
xendit.Opt.SecretKey = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
stopData := recurringpayment.StopParams{
ID: "579c8d61f23fa4ca35e52da3",
}
resp, err := recurringpayment.Stop(&stopData)
if err != nil {
log.Fatal(err)
}
fmt.Printf("stopped recurring payment: %+v\n", resp)
from xendit import Xendit
api_key = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
xendit_instance = Xendit(api_key=api_key)
RecurringPayment = xendit_instance.RecurringPayment
recurring_payment = RecurringPayment.stop(
id="5f05825ff9f52d3ed204c687",
)
print(recurring_payment)
Header Parameter | Type | Description |
---|---|---|
for-user-idoptional |
string |
The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information |
Path Parameter | Type | Description |
---|---|---|
id required |
string |
ID of the recurring payment to stop |
Response Parameters
Example: Stop Recurring Payment Response
{
"id": "579c8d61f23fa4ca35e52da3",
"user_id": "5781d19b2e2385880609791c",
"external_id": "recurring_31451441",
"status": "STOPPED",
"amount": 125000,
"payer_email": "sample_email@xendit.co",
"description": "Monthly room cleaning service",
"interval": "MONTH",
"interval_count": 1,
"recurrence_progress": 1,
"should_send_email": true,
"missed_payment_action": "IGNORE",
"recharge": true,
"created": "2017-06-12T14:00:00.306Z",
"updated": "2018-06-12T14:00:00.306Z",
"start_date": "2017-07-12T14:00:00.306Z"
}
All response parameters will be the same as get recurring
Error Codes
Error Code | Description |
---|---|
REQUEST_FORBIDDEN403 |
API key in use does not have necessary permissions to perform the request. Please assign proper permissions for the key. Learn more here |
NOT_FOUND_ERROR404 |
Could not find recurring by id. |
Pause Recurring Payment
Endpoint: Pause Recurring Payment
POST https://api.xendit.co/recurring_payments/{id}/pause!
Request Parameters
Example Pause Recurring Payment Request
curl https://api.xendit.co/recurring_payments/{id}/pause!
-X POST \
-u xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==:
<?php
use Xendit\Xendit;
require 'vendor/autoload.php';
Xendit::setApiKey('xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==');
$id = '579c8d61f23fa4ca35e52da3';
$pauseRecurring = \Xendit\Recurring::pause($id);
var_dump($pauseRecurring);
?>
const x = new require('xendit-node')({ secretKey: 'xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==' });
const { RecurringPayment } = x;
const rpSpecificOptions = {};
const rp = new RecurringPayment(rpSpecificOptions);
const resp = await rp.pausePayment({ id: '579c8d61f23fa4ca35e52da3' });
console.log(resp);
Xendit.apiKey = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==";
try {
RecurringPayment recurringPayment = RecurringPayment.pause("EXAMPLE_ID");
} catch (XenditException e) {
e.printStackTrace();
}
xendit.Opt.SecretKey = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
pauseData := recurringpayment.PauseParams{
ID: "579c8d61f23fa4ca35e52da3",
}
resp, err := recurringpayment.Pause(&pauseData)
if err != nil {
log.Fatal(err)
}
fmt.Printf("paused recurring payment: %+v\n", resp)
from xendit import Xendit
api_key = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
xendit_instance = Xendit(api_key=api_key)
RecurringPayment = xendit_instance.RecurringPayment
recurring_payment = RecurringPayment.pause(
id="5f05825ff9f52d3ed204c687",
)
print(recurring_payment)
Header Parameter | Type | Description |
---|---|---|
for-user-idoptional |
string |
The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information |
Path Parameter | Type | Description |
---|---|---|
id required |
string |
ID of the recurring payment to pause |
Response Parameters
Example Pause Recurring Response
{
"id": "579c8d61f23fa4ca35e52da3",
"user_id": "5781d19b2e2385880609791c",
"external_id": "recurring_31451441",
"status": "PAUSED",
"amount": 125000,
"payer_email": "sample_email@xendit.co",
"description": "Monthly room cleaning service",
"interval": "MONTH",
"interval_count": 1,
"recurrence_progress": 1,
"should_send_email": true,
"recharge": true,
"missed_payment_action": "IGNORE",
"created": "2017-06-12T14:00:00.306Z",
"updated": "2018-06-12T14:00:00.306Z",
"start_date": "2017-07-12T14:00:00.306Z"
}
All response parameters will be the same as get recurring
Error Codes
Error Code | Description |
---|---|
REQUEST_FORBIDDEN403 |
API key in use does not have necessary permissions to perform the request. Please assign proper permissions for the key. Learn more here |
NOT_FOUND_ERROR404 |
Could not find recurring by id. |
Resume Recurring Payment
Endpoint: Resume Recurring
POST https://api.xendit.co/recurring_payments/{id}/resume!
Request Parameters
Example Resume Recurring Request
curl https://api.xendit.co/recurring_payments/{id}/resume!
-X POST \
-u xnd_development_O46JfOtygef9kMNsK+ZPGT+ZZ9b3ooF4w3Dn+R1k+2fT/7GlCAN3jg==:
<?php
use Xendit\Xendit;
require 'vendor/autoload.php';
Xendit::setApiKey('xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==');
$id = '579c8d61f23fa4ca35e52da3';
$resumeRecurring = \Xendit\Recurring::resume($id);
var_dump($resumeRecurring);
?>
const x = new require('xendit-node')({ secretKey: 'xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==' });
const { RecurringPayment } = x;
const rpSpecificOptions = {};
const rp = new RecurringPayment(rpSpecificOptions);
const resp = await rp.resumePayment({ id: '579c8d61f23fa4ca35e52da3' });
console.log(resp);
Xendit.apiKey = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==";
try {
RecurringPayment recurringPayment = RecurringPayment.resume("579c8d61f23fa4ca35e52da3");
} catch (XenditException e) {
e.printStackTrace();
}
xendit.Opt.SecretKey = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
resumeData := recurringpayment.ResumeParams{
ID: "579c8d61f23fa4ca35e52da3",
}
resp, err := recurringpayment.Resume(&resumeData)
if err != nil {
log.Fatal(err)
}
fmt.Printf("resumed recurring payment: %+v\n", resp)
from xendit import Xendit
api_key = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
xendit_instance = Xendit(api_key=api_key)
RecurringPayment = xendit_instance.RecurringPayment
recurring_payment = RecurringPayment.resume(
id="5f05825ff9f52d3ed204c687",
)
print(recurring_payment)
Header Parameter | Type | Description |
---|---|---|
for-user-idoptional |
string |
The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information |
Path Parameter | Type | Description |
---|---|---|
id required |
string |
ID of the recurring payment to resume |
Response Parameters
Example Resume Recurring Response
{
"id": "579c8d61f23fa4ca35e52da3",
"user_id": "5781d19b2e2385880609791c",
"external_id": "recurring_31451441",
"status": "ACTIVE",
"amount": 125000,
"payer_email": "sample_email@xendit.co",
"description": "Monthly room cleaning service",
"interval": "MONTH",
"interval_count": 1,
"recurrence_progress": 1,
"should_send_email": true,
"missed_payment_action": "IGNORE",
"recharge": true,
"created": "2017-06-12T14:00:00.306Z",
"updated": "2018-06-12T14:00:00.306Z",
"start_date": "2017-07-12T14:00:00.306Z"
}
All response parameters will be the same as get recurring
Error Codes
Error Code | Description |
---|---|
REQUEST_FORBIDDEN403 |
API key in use does not have necessary permissions to perform the request. Please assign proper permissions for the key. Learn more here |
NOT_FOUND_ERROR404 |
Could not find recurring by id. |
Recurring Callback
Xendit will notify you of all Recurring Payment Invoice activity via the usual invoice callback. Please visit invoice callback to get more information about setting up your callback URL and getting invoice callbacks.
Additional parameters from invoice callback if you are using recurring payments:
Parameter | Type | Description |
---|---|---|
recurring_payment_id | string |
ID of the recurring payment for this invoice |
Get List of Payments
Getting list of the payments can be done by searching invoices with certain recurring_payment_id and it can be done using List all invoices.
Additional parameters from listing all invoice if you are using recurring payments:
Request Parameters
Header Parameter | Type | Description |
---|---|---|
for-user-idoptional |
string |
The sub-account user-id that you want to make this transaction for. This header is only used if you have access to xenPlatform. See xenPlatform for more information |
Parameter | Type | Description |
---|---|---|
recurring_payment_id | string |
ID of the recurring payment for this invoice |