1
votes

I have been trying to set up an ExpressCheckout with recurring payments but I don't find the solution.

Having a look at the documentation (Recurring Payments With the Express Checkout API), the diagram gives a sequence where "CreateRecurringPaymentsProfile" is invoked at the end.

Now, having a look at the other documentation (How to Create a Recurring Payments Profile with Express Checkout), the different steps which are explained give a different sequence order, where "CreateRecurringPaymentsProfile" comes directly after "GetExpressCheckoutDetails".

I tried to follow this second example but I systematically receive an error.

Could someone tell me what I exactly need to do? Of course a practical example would be more than welcome...

In advance, many thanks

Additional information:

The error I am receiving is "INVALID TOKEN".

Here is the information I send:

VERSION=84.0
METHOD=CreateRecurringPaymentsProfile
LOCALECODE=FR
TOKEN=[the one I received from SetExpressCheckout]
PROFILESTARTDATE=[the date of the next payment]
BILLINGPERIOD=Month
BILLINGFREQUENCY=6
TOTALBILLINGCYCLES=0
AMT=[the same as I mentioned in PAYMENTREQUEST_0_AMT]
AUTOBILLAMT=AddToNextBilling
CURRENCYCODE=EUR
MAXFAILEDPAYMENTS=3
DESC=[the same as I mentioned in L_BILLINGAGREEMENTDESCRIPTION0]
L_PAYMENTREQUEST_0_NAME0=[the same as I used in SetExpressCheckout]
L_PAYMENTREQUEST_0_DESC0=[the same as I used in SetExpressCheckout]
L_PAYMENTREQUEST_0_AMT0=[the same as I used in SetExpressCheckout]
L_PAYMENTREQUEST_0_QTY0=[the same as I used in SetExpressCheckout]
L_PAYMENTREQUEST_0_TAXAMT0=[the same as I used in SetExpressCheckout]

Do I also need to mention: L_BILLINGAGREEMENTDESCRIPTION0 & L_BILLINGTYPE0 ?

1
@Machavity can i use Express checkout payment for monthly payment with dynamic amount like(i have packages of channel and each package have some amount that is different.)and user pay for one month then this pack will renew next month automatically and amount is deduct . can i do this .Dipang
The error I am getting is "Invalid Token".boeledi

1 Answers

1
votes

In case you get 11502 Invalid token, you will need to pass the following variables in your SetEC API request:

BILLINGAGREEMENTDESCRIPTION=Your billing agreement name
BILLINGTYPE=RecurringPayments

Please, check below how EC+RP flow works:

1) SetExpressChekout + BILLINGAGREEMENTDESCRIPTION and BILLINGTYPE variables

VERSION = 86.0
METHOD = SetExpressCheckout
RETURNURL = http://www.website.com/return.php
CANCELURL = http://www.website.com/cancel.php
PAYMENTREQUEST_0_CURRENCYCODE = USD
PAYMENTREQUEST_0_PAYMENTACTION = SALE
L_BILLINGTYPE0 = RecurringPayments
L_BILLINGAGREEMENTDESCRIPTION0 = SameEveryTime
PAYMENTREQUEST_0_AMT = 1.00
PAYMENTREQUEST_0_ITEMAMT = 1.00
PAYMENTREQUEST_0_DESC = Labs
L_PAYMENTREQUEST_0_NAME0 = Lab 1
L_PAYMENTREQUEST_0_NUMBER0 = 10101
L_PAYMENTREQUEST_0_QTY0 = 1
L_PAYMENTREQUEST_0_AMT0 = 1.00
L_PAYMENTREQUEST_0_DESC0 = Download

2) Login into your PayPal account and click on “Accept and Continue”

https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-2EJ022116H3067544

Buyer logs into his PayPal account and click on the button “Agree and Continue”, then he will be redirect to RETURNURL+ token+ PayerID:

http://www.website.com/return.php?token=EC-2EJ022116H3067544&PayerID=HHHAPCFUM9ULW

3) Then you can run CreateRecurringPaymentsProfile + token:

PROFILEREFERENCE=RPInvoice123
PROFILESTARTDATE=2016-08-17T14:30:00Z
SUBSCRIBERNAME=Mr Sub Scriber
METHOD=CreateRecurringPaymentsProfile
TOKEN=XXXXXXXXXXXXX
DESC=SameEveryTime
AMT = 1.00
BILLINGPERIOD=Day
BILLINGFREQUENCY=3
VERSION=86.0
MAXFAILEDPAYMENTS=1
L_PAYMENTREQUEST_0_AMT0=1.00
L_PAYMENTREQUEST_0_NAME0=Lab 1
L_PAYMENTREQUEST_0_NUMBER0=10101
L_PAYMENTREQUEST_0_QTY0=1
L_BILLINGTYPE0=RecurringPayments
L_BILLINGAGREEMENTDESCRIPTION0=SameEveryTime
L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital

and this is the NVP Response:

PROFILEID=I-TOKEN123456
PROFILESTATUS=ActiveProfile
TIMESTAMP=2013-11-22T04:06:50Z
CORRELATIONID=2b5be15a871ff
ACK=Success
VERSION=86.0
BUILD=5908853

Documentation: ECRecurringPayments

API references (NVP)
SetExpressCheckout API request
CreateRecurringPayment API request