PayPalRest API for recurring plan won't work with free trial

frankni
Contributor
Contributor

Hi,

 

I need to set up a recurring plan for customers with free trial, it won't work. I have to charge $0.01 for the initial payment for it to work. What do I do wrong?

 

When I give $setupFee = 0, it returns error message as below:

{"name":"CC_DECLINED","message":"This transaction cannot be processed.","information_link":"https://developer.paypal.com/docs/api/payments.billing-agreements#errors","debug_id":"e2f39a27a5dd"}

 

If I give $setupFee = 0.01, it works!

 

Below is how I create the MerchantPreferences.

 

$merchantPreferences = new PayPal\Api\MerchantPreferences();
$merchantPreferences->setReturnUrl( $returnUrl )
->setCancelUrl( $cancelUrl )
->setAutoBillAmount( "yes" )
->setInitialFailAmountAction( "CONTINUE" )
->setMaxFailAttempts( "3" )
->setSetupFee( new PpCurrency( array( 'value' => $setupFee, 'currency' => 'USD' ) ) );

 

 

Login to Me Too
1 REPLY 1

MTS_Jennifer
Moderator
Moderator

Hello,

Thank you for posting to the PayPal Sandbox Community.

In the new Subscriptions API documentation and code sample on PayPal Developer there is no setup fee variable listed for the free trial. The Setup fee determines the initial amount that will be charged. If no setup fee variable is listed no setup fee is charged. If you use the Setup Fee variable then an amount is expected.

Here's the documentation on offering a free trial:

https://developer.paypal.com/docs/business/subscriptions/add-capabilities/trial-period/

 

Thank you,

Jennifer

PayPal

 

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.