Implementation of free trial period with PayPal do

2019-05-30 11:18发布

问题:

Got stuck with this issue for last 2 days.

Scenario

We have a web based product where users can signup for free for 14 days and thereafter monthly subscription of say $60.00. Once users clicked "Pay with Paypal" button out page will taken users to Paypal and once they have done the payment it redirects back to our website. All the parameters were passed looks fine, since i tested with sandbox as merchant and user. we were using Return URL property on merchant profile setting under Website Payment Preferences.

Research

Most similar questions are Implementing a free trial period with PayPal and Paypal subscription free trial isn't working but my issue is bit different. And also the document pointed in the first question is not a valid link.

Issue

When user's being returned back to our website, we can not retrieve custom variable which we passed in during initial redirection to PayPal. Basically it was just a blank redirection without any query-string or post parameter. But then i try to charge an amount for first 14 days instead of free, then all query string returned. Our flow is depend on the custom parameter where we map pay pal id with actual customer data.

Our code looks like,

<form name='paypal' action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post'>
<input type='hidden' name='business' value='xxx@xxxxx.com'>
<input type='hidden' name='no_shipping' value='1'>
<input type='hidden' name='cmd' value='_xclick-subscriptions'>
<input type='hidden' name='a3' value='60.00'>
<input type='hidden' name='item_name' value='Product A'>"
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='custom' value='parameter1|parameter2'>
<input type='hidden' name='item_number' value='PlanCode'>
<input type='hidden' name='p3' value='1'>"
<input type='hidden' name='t3' value='M'>"
<input type='hidden' name='a1' value='0'>" 
<input type='hidden' name='p1' value='14'>" 
<input type='hidden' name='t1' value='D'> 
</form>

I tried by adding,

<input type='hidden' name='rm' value='1'>

But no luck.

Questions

  1. why i couldn't get callback parameters when "a1=0" for 14 days? But the same code works if i set "a1" bigger than 0?
  2. Am i missing any parameter? or i am using wrong approach on call back? (I am using Return URL)
  3. What about using IPN? I understood from PayPal site IPN is not real-time. Since our application relies on custom data for next signup flow, i wonder is it ok to use it? If so what would be the initial doc to be studied?

回答1:

I got response from paypal forum for this question. I am adding this as answer as this will help other developers in future. Also good starting point for IPN

Response was,

"If you are using PDT, then nothing will be sent back as no payment is taking place. Information will only be sent back if you are making a payment. I would recommend using IPN. Both the rm variable and PDT are dependent on the buyer returning back to your site. If the buyer does not return, such as their browser window unexpectedly crashes and closes, or they simply shut it no information will be sent back and it will be lost. This is why the rm variable and PDT are used more for creating dynamic receipts. IPN is more used for updating your system as it does not rely on the buyer returning back to your site. "

"Also with IPN you can resend the data to your system if you need to, and you can also view your IPN history from within your account. IPN usually takes place right after the payment is completed."

Please Refer for Original question