Question

OK, PayPal's docs and examples are pain awful so I hope someone else could help me figure this out. I'm doing a PayPal SetExpressCheckout request using their NVP API. It seems that my code produces one-time payment and not a subscription (which I figured out when receiving IPNs in the single-payment format, not subscription format, also on the sandbox buyer/seller panel in paypal there is nothing that says that the payments in the history are recurring), so I want to know what am I doing wrong. Those are the key => value pairs that I use, of course I implode and send them to PayPal in the right manner - as I said it works but not the way I want it.

array
  'METHOD' => string 'SetExpressCheckout' (length=18)
  'PAYMENTREQUEST_0_AMT' => string '3.99' (length=4)
  'PAYMENTREQUEST_0_CURRENCYCODE' => string 'USD' (length=3)
  'PAYMENTREQUEST_0_PAYMENTACTION' => string 'Sale' (length=4)
  'PAYMENTREQUEST_0_INVNUM' => int 93
  'PAYMENTREQUEST_0_CUSTOM' => string '394mtrf1h5lfdeehvgrferk1n1' (length=26)
  'LOCALECODE' => string 'EN' (length=2)
  'NOSHIPPING' => int 1
  'REQCONFIRMSHIPPING' => int 0
  'RETURNURL' => string 'http://MYDOMAINXXXX.COM/payPal/return' (length=44)
  'CANCELURL' => string 'http://MYDOMAINXXXX.COM/upgrade' (length=38)
  'ALLOWNOTE' => int 0
  'LANDINGPAGE' => string 'Billing' (length=7)
  'EMAIL' => string 'dimitar@instinctiv.com' (length=22)
  'BILLINGPERIOD' => string 'Month' (length=5)
  'BILLINGFREQUENCY' => int 1
  'PROFILESTARTDATE' => string '2011-07-26' (length=10)
  'L_BILLINGTYPE0' => string 'RecurringPayments' (length=17)
  'L_BILLINGAGREEMENTDESCRIPTION0' => string 'Basic Subscription - 25GB' (length=34)
  'VERSION' => string '63.0' (length=4)
  'USER' => string 'pro_1307543338_biz_api1.gmail.com' (length=33)
  'PWD' => string 'XXXXXXXXX' (length=10)
  'SIGNATURE' => string 'AdTGraIKTCQ-O2lYSLlGJVfeJ1FWAKhC6Y8qZZxqGGkKkccrGxO45emb' (length=56)

I suspect the problem might be PAYMENTREQUEST_0_AMT and the other PAYMENTREQUEST_N_XXX keys, as in the PayPal docs I see that "PAYMENTREQUEST_N_AMT" "SHOULD BE" set to 0 for recurring payments, but also in the docs they say that "AMT is used to point out the amount to be billed on each billing cycle and is deprecated, to use PAYMENTREQUEST_N_AMT instead"!?

Any help is appreciated. If you need more specific info I will provide everything, just add a comment.

Was it helpful?

Solution

You still have to call CreateRecurringPaymentsProfile to create the recurring payments profile. If you don't want to bill an initial amount, you could leave the AMT set to '0' for your SetExpressCheckout API call. See also https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_CreateRecurringPayments and Table 4.2 in https://www.paypalobjects.com/en_US/ebook/PP_ExpressCheckout_IntegrationGuide/RecurringPayments.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top