Before talking about PDT, the easiest way to enable paypal integration, use the code below.
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="test@test.com" />
<input type="hidden" name="return" value="paymentdone.aspx">
<input type="hidden" name="cancel_return" value="http://cancel.aspx">
<input type="hidden" name="currency_code" value="SGD">
<input type="hidden" name="custom" value="1188967">
<input type="hidden" name="item_name" value="12 months Membership" />
<input type="hidden" name="amount" value="10.00" />
<input type="submit" value="Buy!" />
After user make payment through payment, user is required to click 'Return to seller website'.
If PDT is enabled under your seller profile, it will return tx (txn id) to your designated return page.
The page return from Paypal will contain the parameter in query string as below.
http://YourReturnWebsite.aspx?tx=0YB16486MY080364E&st=Pending&amt=10.00&cc=SGD&cm=1188967&item_number=
cm is the custom parameter that you put in your 'buying' page. This is useful to identify the transaction your customer made.
With the tx (txn id) given, you can do a http post to paypal again to retrieve the txn details, and the response you can get is something like below, which contain the detail of the transaction.
SUCCESS mc_gross=10.00 protection_eligibility=Partially+Eligible+-+INR+Only address_status=unconfirmed payer_id=NWDEUYU4YEE32 tax=0.00 address_street=1111 payment_date=04%3A57%3A24+Aug+07%2C+2011+PDT payment_status=Pending charset=windows-1252 address_zip=11111 first_name=Tan address_country_code=SG address_name=Henry+Tan custom=1188967 payer_status=unverified business=sales_biz%40email.com address_country=Singapore address_city=Singapore quantity=1 payer_email=test1_1312687433_per%40email.com txn_id=0YB16486MY080364E payment_type=instant last_name=Henry address_state= receiver_email=sales_1312687640_biz%40marketdata360.com receiver_id=L6DQ94PEGKY5S pending_reason=multi_currency txn_type=web_accept item_name=12+months+Membership mc_currency=SGD item_number= residence_country=SG receipt_id=3184-4081-1163-0163 handling_amount=0.00 transaction_subject=1188967 payment_gross= shipping=0.00
The limitation for PDT is that, you wont receive these information if user didnt click on 'return to seller website'
Refer to this article for more details.
one more official site for the variables
Official Paypal site
Sunday, August 7, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment