PayPal billing agreements REST API - how to start immediately

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);
}

I've talked to a PayPal rep and found that start_date must be tomorrow or later. They are going to add this to the docs.

If you want to start monthly billing immediately you might be able to do it by setting the start date to be in one months time and charging a setup fee to cover the first month. I haven't tested this as it's not what I want.


I used this date format working.

  $time = time();
  $startDate = date('Y-m-d\\TH:i:s\\Z', $time);

Tags:

Paypal