OpenBuildings / paypal

PayPal SDK for ExpressCheckout and AdaptivePayments.
Other
29 stars 24 forks source link

Recurring payments error #5

Open hkdobrev opened 11 years ago

hkdobrev commented 11 years ago

A bug report from Victor Kosh:

I use your Bundle in my symfony2 project, and I'm happy with it, but there is a little problem with recurring payments, I had this error

"PayPal API request did not succeed for https://api-3t.sandbox.paypal.com/nvp failed: Item name, amount and quantity are required if item category is provided. (10003). "

To fix it I went to OpenBuildings/Paypal/Payment/Recurring.php to class Payment_Recurring

found function protected function _set_params() and removed the line 'L_PAYMENTREQUEST_0_ITEMCATEGORY0' => 'Digital',

Now everything works well, but I don't like the way I fixed it.

It would be great if you have time to help me find out what is wrong.

Here is order of my actions:

1.

\OpenBuildings\PayPal\Payment::instance('Recurring')
    ->config(array(
        "username" => $this->paypalUsername,
        "password" => $this->paypalPassowrd,
        "signature" => $this->paypalSignature,
        "client_id" => $this->paypalClientId,
        "secret" => $this->paypalSecret,
        "description"=>$this->userSubscriptionDescription,
        "amount_per_month"=>1,
        "charged_yearly"=>true,
        "billing_period"=>"Day",
        "billing_frequency"=>"1",
        "amount"=>$this->userSubscriptionPrice
    ));

2.

$instance = \OpenBuildings\PayPal\Payment::instance('Recurring')->order(array(
        'items_price' => $itemPrice,
        'shipping_price' => $shippingPrice,
        'total_price' => $totalPrice,
    ))
    ->return_url($returnUrl)
    ->cancel_url($cancelUrl);

3.

$instance->set_express_checkout();  // here I had that error
victorpaul commented 11 years ago

Great, thank you for quick response, I will watch it!!