Getting an error while attempting to create a billing plan: "Got Http response code 500 when accessing https://api.paypal.com/v1/payments/billing-plans/.'"
Happening on both sandbox and live.
Debug ID: 1e68b5b685bae
Code (PHP SDK):
$plan = new Plan();
$plan->setName('<SubscriptionName>')
->setDescription('<SubscriptionDescription>')
->setType('infinite');
$paymentDefinition = new PaymentDefinition();
$paymentDefinition->setName('Regular Payments')
->setType('REGULAR')
->setFrequency('Month')
->setFrequencyInterval("1")
->setCycles("0")
->setAmount(new Currency(array('value' => 14.99, 'currency' => 'USD')));
$paymentDefinition->setChargeModels(array(null));
$merchantPreferences = new MerchantPreferences();
$baseUrl = "<url>";
$merchantPreferences->setReturnUrl("$baseUrl/ExecuteAgreement.php?success=true")
->setCancelUrl("$baseUrl/ExecuteAgreement.php?success=false")
->setAutoBillAmount("yes")
->setInitialFailAmountAction("CONTINUE")
->setMaxFailAttempts("2")
->setSetupFee(new Currency(array('value' => 0, 'currency' => 'USD')));
$plan->setPaymentDefinitions(array($paymentDefinition));
$plan->setMerchantPreferences($merchantPreferences);
$request = clone $plan;
$output;
try {
$output = $plan->create($apiContext);
} catch (Exception $ex) {
echo 'Error: '.$ex.'.';
die;
}
... View more