I am using Django paypalrestsdk for PayPal https://github.com/paypal/PayPal-Python-SDK
And I would like to setup a monthly subscription plan. Every beginning of the
Paypal will automatically try to keep the billing date the same for every month (where applicable, as stated in the linked resource).
You can state the starting date of a billing agreement as stated in this example, by specifying a start_date
field.
Here I use the arrow module, to conveniently calculate the first day of the next month:
import arrow
billing_plan = paypalrestsdk.BillingPlan({
"name": "Monthly Billing Plan",
"description": "Monthly Plan",
"start_date": arrow.utcnow().shift(months=+1).replace(day=1).isoformat(),
"merchant_preferences": {
...
"setup_fee": {
"currency": "USD",
"value": "100"
}
}
...
})
The initial subscription fee should be handled by the setup_fee
field!
EDIT after question update:
On the merchant_preferences
field of your plan, you are setting auto_bill_amount
to yes
.
By taking a look at the documentation on merchant_preferences we can see that:
auto_bill_amount
enumIndicates whether PayPal automatically bills the outstanding balance in the next billing cycle. The outstanding balance is the total amount of any previously failed scheduled payments. Value is:
NO
. PayPal does not automatically bill the customer the outstanding >balance.
YES
. PayPal automatically bills the customer the outstanding balance.Possible values:
YES
,NO
.Default:
NO
.