I am trying to integrate the Paypal recurring payments for my mobile app. So far I managed to implement Paypal payments on various PHP apps using using https://github.com/paypal/PayPal-PHP-SDK, but this is the first time I am implementing recurring payments
I am trying to build the payment for the billing plan using the following code:
$paymentDefinition = new PaymentDefinition();
$paymentDefinition->setName('Mobile App subscription')
->setType('REGULAR')
->setFrequency('Month')
->setFrequencyInterval("1")
->setCycles("1")
->setAmount(
new Currency(
array(
'value' => 50,
'currency' => 'USD'
)
)
);
From the Paypal documentation, I understood that "setCycles" should be set to 0 for unlimited subscriptions. Setting it to 0 using the PHP SDK returns a 400 error.
Everything looks fine and I am receiving the first payment, but I am not sure that setting the Cycle to "1" will do the job I am looking for.