paypal monthly subscription plan settings for first day of the month and making monthly recurring payment - django python

后端 未结 1 1967
情歌与酒
情歌与酒 2021-01-07 22:10

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

1条回答
  •  花落未央
    2021-01-07 22:42

    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_datefield.
    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 enum

    Indicates 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.

    0 讨论(0)
提交回复
热议问题