Search code examples
paypalpaypal-nvp

PayPal NVP API - BMUpdateButton


I have a hosted subscribe button with PayPal, which I want to have an unlimited number of billing cycles. This is easy enough to set up through the PayPal web interface, by setting 'After how many cycles should billing stop?' to 'Never'. However, when I then update that button through the PayPal NVP API BMUpdateButton, the number of billing cycles shows to the user as '$25.00 AUD for one month' instead of '$25.00 AUD for each month'. The button still shows 'Never' as the value in the web interface, but when it is used, the button is set to complete after 1 month.

I have tried variations of L_OPTIONnTOTALBILLINGCYCLESx API parameter, but with no success. Any help or thoughts would be appreciated. For all I know, this is a subtle bug in PayPal itself. If anyone has reason to believe that if I switch from NVP to SOAP it will work, then that would also count as a solution.

Here is a sample of the parameters that I send through. I don't get any API errors, and the button updates correctly except for the total billing cycles.

'METHOD' => BMUpdateButton
'VERSION' => 117
'USER' => ...
'PWD' => ...
'SIGNATURE' => ...

'L_OPTION0SELECT0' => First Tier
'L_OPTION0PRICE0' => 25.00
'L_OPTION0BILLINGPERIOD0' => Month
'L_OPTION0BILLINGFREQUENCY0' => 1
'L_OPTION0TOTALBILLINGCYCLES0' => 0

'L_OPTION0SELECT1' => Second Tier
'L_OPTION0PRICE1' => 30.00
'L_OPTION0BILLINGPERIOD1' => Month
'L_OPTION0BILLINGFREQUENCY1' => 1
'L_OPTION0TOTALBILLINGCYCLES1' => 0

'HOSTEDBUTTONID' => ...
'BUTTONTYPE' => SUBSCRIBE
'OPTION0NAME' => Payment Scheme
'L_BUTTONVAR0' => currency_code=AUD
'L_BUTTONVAR1' => no_shipping=1
'L_BUTTONVAR2' => cancel_return=...
'L_BUTTONVAR3' => return=...

Thanks very much for any thoughts.


Solution

  • The below two parameters in your API call is related to the installment buttons and if you pass them with the subscription type button they will be ignored.

    L_OPTION0BILLINGFREQUENCY0

    L_OPTION0TOTALBILLINGCYCLES0

    If you are looking to update the subscription billing cycles you need to pass these two parameters :

    L_BUTTONVARn="src=1"

    L_BUTTONVARn="srt=12"

    If the above src=1 means profile is set to be recurring and srt=12 will set the billing cycle to 12 .

    If you don't pass any of the parameter in the API call then by default "src" will be set to "0" meaning no recurrence which is similar to your case .