PayPal billing agreements REST API - how to start immediately

后端 未结 5 1153
抹茶落季
抹茶落季 2021-02-08 07:23

How can I start charging a user the user immediately for a PayPal billing agreement?

Here\'s what I\'ve got so far.

  1. Create a Billing Plan (POST .../payment
5条回答
  •  别跟我提以往
    2021-02-08 07:24

    First payment for agreements will be billed right on specified start_date. The subsequent amounts are also taken automatically by PP. You need to work with the BillOutstandingAmount calls only if PP failed to pick the payment on the renewal date.

    The problem I faced when developing with their RestAPI was specifying a wrong timezone. Maybe this is the same for you. Make sure the proper timezone is specified in your start_date (with all dates given to PP in fact)

    Dates should be in this format: yyyy-MM-ddTHH:mm:ssZ

    ex. start_date = 2014-09-16T09:20:00-0400

    IF you want to make sure Paypal accepts the date as being valid, just add a few seconds to it.

    Let's say you are in Java, you can do something like:

    private String getPaypalDate()
    {
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
    
        // Add 30 seconds to make sure Paypal accept the agreement date
        Date rightNow = new Date(new Date().getTime() + 30000);
    
        return df.format(rightNow);
    }
    

提交回复
热议问题