Payment works, but the user never knows if it was a subscription or a one-time payment on the Paypal page

So, I integrated Paypal into my payment stream, and this happens:

  • The user comes to the page. Click the "Billing" button
  • The user is first redirected to a page that calls SetExpressCheckout and redirected to Paypal. (He should be billed once, say, $ 77, and then every month for 1 year for the same amount. Therefore, I do not set the initial amount, but subtract it directly.)
  • Upon returning, he presses the confirmation button and is subtracted once using DoExpressCheckout and a billing profile is created.

Everything works perfectly. I get paid every month. The user is not exposed twice at the beginning.

PROBLEM: When a user was redirected to Paypal, he sees only the username and DESCRIPTION. That is, Paypal does not describe whether the transaction is a one-time or a subscription, for example, when you use a simple subscription button for payment. Paypal mentions the amount, but not the type of transaction.

 NVPEncoder encoder = new NVPEncoder(); encoder.add("METHOD","SetExpressCheckout"); encoder.add("RETURNURL",returnURL); encoder.add("CANCELURL",cancelURL); encoder.add("CURRENCYCODE","USD"); encoder.add("AMT",amt); encoder.add("BILLINGPERIOD", "Month"); encoder.add("BILLINGFREQUENCY", "1"); encoder.add("PROFILESTARTDATE",dateFormatGmt.format(new Date())); encoder.add("L_BILLINGTYPE0", "RecurringPayments"); encoder.add("L_BILLINGAGREEMENTDESCRIPTION0",package_name); encoder.add("L_NAME0",package_name); encoder.add("L_AMT0",amt); encoder.add("L_QTY0","1"); String strNVPRequest = encoder.encode(); String ppresponse = (String) caller.call(strNVPRequest); NVPDecoder resultValues = new NVPDecoder(); resultValues.decode(ppresponse); String strAck = resultValues.get("ACK"); if (strAck !=null && !(strAck.equals("Success") || strAck.equals("SuccessWithWarning"))) { response.sendRedirect("APIError.jsp"); } else { response.sendRedirect(redirectUrl); } 
+4
source share
1 answer

Do you include L_BILLINGTYPE0=RecurringPayments ?
This is what should change the wording on the PayPal landing page.

Repeat call the following API calls with (at least) the following parameters:

SetExpressCheckout :

 $nvps = array(); $nvps["VERSION"] = "80.0"; $nvps["METHOD"] = "SetExpressCheckout"; $nvps["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale"; $nvps["PAYMENTREQUEST_0_AMT"] = "1.00"; $nvps["PAYMENTREQUEST_0_CURRENCYCODE"] = "GBP"; $nvps["PAYMENTREQUEST_0_ITEMAMT"] = "1.00"; $nvps["L_BILLINGTYPE0"] = 'RecurringPayments'; $nvps["L_BILLINGAGREEMENTDESCRIPTION0"] = "the subscription"; $nvps["L_PAYMENTREQUEST_0_NUMBER0"] = 1; $nvps["L_PAYMENTREQUEST_0_NAME0"]= "subscription"; $nvps["L_PAYMENTREQUEST_0_AMT0"]= 1.00; $nvps["L_PAYMENTREQUEST_0_QTY0"]= 1; 

And CreateRecurringPaymentsProfile :

 $nvps["PROFILESTARTDATE"] = "2011-07-08T17:40:00Z"; $nvps["BILLINGPERIOD"] = "Month"; $nvps["BILLINGFREQUENCY"] = "1"; $nvps["AMT"] = "1.00"; $nvps["CURRENCYCODE"] = "GBP"; $nvps["DESC"] = "the subscription"; 
+4
source

Source: https://habr.com/ru/post/1392870/


All Articles