B
B
Billflow
Search…
Indian Recurring Payments
It only applies to customers located in India. Two changes need to be made for customers in India. One is to set all new subscriptions created to "Send Invoice" instead of "Charge Automatically" and to set the days until due option. The second change is to update existing subscriptions for Indian customers.

Options for new subscribers

Set the "Days Until Due" option in the Checkout Form settings in the Billflow Dashboard. Billflow will automatically set the subscription payment to be via send invoice instead of charge automatically for customers located in India.
Billflow dashboard option

Script for existing subscribers

You will need to update existing subscriptions for Indian customers. You can do this from the dashboard by changing the payment option from automatically charge to send invoice. If you have many customers, you can run the script we have provided below. You can set 'days_until_due' to a value you need.
1
async function main() {
2
const stripe = require("stripe")("your_stripe_secret_key")
3
for await (let subscription of stripe.subscriptions.list({ expand: ["data.default_source", "data.default_payment_method", "data.customer.default_source"] })) {
4
if ((subscription.default_source && subscription.default_source.country == "IN")
5
|| (subscription.default_payment_method && subscription.default_payment_method.card && subscription.default_payment_method.card.country == "IN")
6
|| (subscription.customer.default_source && subscription.customer.default_source.country == "IN")) {
7
console.log("FOUND AN INDIAN CUSTOMER, moving to send_invoice instead of charge_automatically", subscription.customer.id);
8
stripe.subscriptions.update(subscription.id, {
9
collection_method: "send_invoice",
10
days_until_due: 20
11
})
12
}
13
}
14
}
15
main()
Copied!
Last modified 1mo ago