Retrieve and Store paypal subscriptions

I am working with paypal subscription payments, where when user enter a subscription after signing up.

Below is the paypal code that charges users:

<form id="myForm" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="">
<input type="hidden" name="lc" value="CA">
<input type="hidden" name="item_name" value={{currentUser.get('plan')}}>
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="src" value="1">
<input type="hidden" name="a3" value="0.01">
<input type="hidden" name="p3" value="1">




<input type="hidden" name="t3" value="M">
<input type="hidden" name="return" value="">
value="">
<input type="hidden" name="currency_code" value="CAD">
<input type="hidden" name="bn" value="PP-SubscriptionsBF:btn_subscribeCC_LG.gif:NonHostedGuest">

</form>

Now I want to store the confirmed payments (i.e. amount, date, etc) into Parse for the current user but not sure how to do it. Any help would be greatly appreciated.

Any help would be greatly appreciated.

Update: success.php?tx=6BA48179L4889664N&st=Pending&amt=0%2e01&cc=CAD&cm=&item_number=&sig=Hfh95Y%2fv8XTcl9zZasPjTwswbzJ2CRgSxRX%2f5U%2fmtDxQQk1cCOpuUH4awkCCGSQsI%2fgQnNeg%2bKUa7a9p0UPwNHQgL%2bST1aonNptQBSXKCVqAlVGY9QMb%2bQJJk2QMxttgKxysFZnBaKxBxLl8E2vbtLNsDflWf%2fJfT2eCMnSlzSc%3d , I need to grab the amont, currency, and tx I have tried to do it using

<?php
//Getting payment details from paypal
$amount = $_GET[‘amt’];
$currency = $_GET[‘cc’];
$trx_id = $_GET[‘tx’];
$invoice = mt_rand();
//inserting the payment to table


echo "$trx_id";

?> but its not working

Answers:

Answer

PayPal can provide information back to you about the subscription using the PDT/IPN variables described here:

https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/#id091EB0901HT

If you are getting the subscription details from PayPal you should use PDT or IPN to ensure the post back to you is legitimate.

However, since you must have had the subscription details in the first place in order to send them to PayPal, you may find it easier/more reliable to record the information yourself in its original format than to reconstruct it from PayPal's variables.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.