2

I tried to process two recurring payment in one session using method CreateRecurringPaymentsProfile. Here is the chronology of my actions:

First I set method SetExpressCheckout:

'METHOD'                        => 'SetExpressCheckout',
'RETURNURL'                     => $this->paypalreturnurl,
'CANCELURL'                     => $this->paypalcancelurl,
'PAYMENTREQUEST_0_CURRENCYCODE' => $this->paypalcurrencycode,
'PAYMENTREQUEST_0_PAYMENTACTION'=> 'SALE',
'L_BILLINGTYPE0'                => 'RecurringPayments',
'L_BILLINGAGREEMENTDESCRIPTION0'=> 'Tier 1 + Management Services',
'PAYMENTREQUEST_0_DESC'         => 'Tier 1 + Management Services',
'L_PAYMENTREQUEST_0_NAME0'      => 'Tier 1',
'L_PAYMENTREQUEST_0_NUMBER0'    => '10101',
'L_PAYMENTREQUEST_0_QTY0'       => '1',
'L_PAYMENTREQUEST_0_AMT0'       => '0.02',
'L_PAYMENTREQUEST_0_DESC0'      => 'Description of Tier 1',
'L_PAYMENTREQUEST_0_NAME1'      => 'Management Services 8 hours - for $0.01',
'L_PAYMENTREQUEST_0_NUMBER1'    => '212121',
'L_PAYMENTREQUEST_0_QTY1'       => '1',
'L_PAYMENTREQUEST_0_AMT1'       => '0.01',
'L_PAYMENTREQUEST_0_DESC1'      => 'Description of Management Services 8 hours - for $0.01',
'PAYMENTREQUEST_0_ITEMAMT'      => '0.03',
'PAYMENTREQUEST_0_AMT'          => '0.03'

After successful response from SetExpressCheckout method, the first recurring payment is executed successfully using CreateRecurringPaymentsProfile method. Here is the parameters:

'L_PAYMENTREQUEST_0_NAME0'      => 'Management Services 8 hours - for $0.01',
'PROFILEREFERENCE'              => 'RPInvoice1234',
'PROFILESTARTDATE'              => date('Y-m-d') . 'T' . date('H:i:s').'Z',
'SUBSCRIBERNAME'                => 'Mr Sub Scriber',
'TOKEN'                         => urlencode($token),
'DESC'                          => 'Tier 1 + Management Services',
'AMT'                           => '0.01',
'BILLINGPERIOD'                 => 'Month',
'BILLINGFREQUENCY'              => '1',
'TOTALBILLINGCYCLES'            => '12',
'REGULARTOTALBILLINGCYCLES'     => '1',
'VERSION'                       => '74.0',
'MAXFAILEDPAYMENTS'             => '1',
'L_PAYMENTREQUEST_0_AMT0'       => '0.01',
'INITAMT'                       => '0.01',
'L_PAYMENTREQUEST_0_NUMBER0'    => '212121',
'L_PAYMENTREQUEST_0_QTY0'       => '1',
'L_BILLINGTYPE0'                => 'RecurringPayments',
'L_BILLINGAGREEMENTDESCRIPTION0'=> 'Tier 1 + Management Services',
'L_PAYMENTREQUEST_0_ITEMCATEGORY0'=> 'Digital'

After the successful response from CreateRecurringPaymentsProfile method, I tried to create another recurring payment ( unfortunately without success ) using similar parameters and again CreateRecurringPaymentsProfile method:

'L_PAYMENTREQUEST_0_NAME0'      => 'Hosted Saas Tier 1',
'PROFILEREFERENCE'              => 'RPInvoice123',
'PROFILESTARTDATE'              => date('Y-m-d') . 'T' . date('H:i:s').'Z',
'SUBSCRIBERNAME'                => 'Mr Sub Scriber 2',
'TOKEN'                         => urlencode($token),
'DESC'                          => 'Hosted Saas Tier 1 + Community Management Services',
'AMT'                           => '0.02',
'BILLINGPERIOD'                 => 'Month',
'BILLINGFREQUENCY'              => '1',
'TOTALBILLINGCYCLES'            => '12',
'REGULARTOTALBILLINGCYCLES'     => '1',
'VERSION'                       => '74.0',
'MAXFAILEDPAYMENTS'             => '1',
'L_PAYMENTREQUEST_0_AMT0'       => '0.02',
'INITAMT'                       => '0.02',
'L_PAYMENTREQUEST_0_NUMBER0'    => '10101',
'L_PAYMENTREQUEST_0_QTY0'       => '1',
'L_BILLINGTYPE0'                => 'RecurringPayments',
'L_BILLINGAGREEMENTDESCRIPTION0'=> 'Hosted Saas Tier 1 + Community Management Services',
'L_PAYMENTREQUEST_0_ITEMCATEGORY0'=> 'Digital'

Unfortunately this method always return the same error, regardless the changes I made:

Profile description is invalid, L_ERRORCODE0 = 11581.

When I change the recurring payments order the same error appears for the first recurring payment with title "Management Services 8 hours - for $0.01" !? The problem is that every time second recurring returns the same error - "Profile description is invalid, L_ERRORCODE0 = 11581."

How can I get this working?

Pavel Kenarov
  • 944
  • 1
  • 9
  • 21

2 Answers2

1

You can only call CreateRecurringPaymentsProfile only one time in one session(one token). you should call SetExpressCheckout to get another token.

PP_MTS_Frank
  • 379
  • 1
  • 2
  • Thanks alot for your answer, I asked paypal support but they didn't answer specifically. I will continue researching – Pavel Kenarov Sep 15 '15 at 07:20
  • I used 2 times SetExpressCheckout following your recommendation and the two recurring payments are created with success BUT this process will be very confused for our customers. As you suggested the user have to login twice in order to get a new token. This is unacceptable. – Pavel Kenarov Sep 15 '15 at 08:19
1

Finally, with a little help from the PayPal support, I find a solution to create multiple recurring profiles in a single Express Checkout session:

  • First you must Pass both Profiles in SetExpressCheckout method (first method in my example), for example:

L_BILLINGTYPE0=RecurringPayments

L_BILLINGAGREEMENTDESCRIPTION0=Tier 1

and second product

L_BILLINGTYPE1=RecurringPayments

L_BILLINGAGREEMENTDESCRIPTION1=Management Services

  • And then, after buyer has approved both in PayPal, you need to call CreateRecurringPaymentsProfile twice:

One sending "DESC" with the value "Tier 1" and another one sending "DESC" with the value "Management Services"

Also check this

Community
  • 1
  • 1
Pavel Kenarov
  • 944
  • 1
  • 9
  • 21
  • So this is quite an old answer, but unfortunately I can't find any other info on this online. I've tried as you've said in your answer but still get the same error code 11581. My SetExpressCheckout method has each profile with both those parameters, and I call CreateRecurringPaymentsProfile twice. The first profile is created successfully, but then the second one fails. – nerdalert Jul 16 '19 at 09:46