PayPal Express Checkout API - Is there a way to pr

2019-02-19 14:48发布

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?

2条回答
萌系小妹纸
2楼-- · 2019-02-19 14:53

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

查看更多
Anthone
3楼-- · 2019-02-19 15:06

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

查看更多
登录 后发表回答