Integrate API

Integrate API - Header

Tuesday, October 8, 2013

How to integrate Paypal Express Checkout in php

Paypal is first choice for any developer and customer for online transaction. For php developer i am going to write some helpful tips which might help them in Paypal integration in php. I know developer have many questions in their mind and face lot of trouble while integrate. Here i start discussion of few topics with their solution.

If you do not have basic understanding of pyapal express checkout please have a look.
How to take off all shipping info from paypal express checkout
=> Do NOT use the following parameter in your $nvpstr.
&L_SHIPPINGOPTIONAMOUNT1=8.00&L_SHIPPINGOPTIONlABEL1=UPS Next Day Air&L_SHIPPINGOPTIONNAME1=UPS Air&L_SHIPPINGOPTIONISDEFAULT1=true&L_SHIPPINGOPTIONAMOUNT0=3.00&L_SHIPPINGOPTIONLABEL0=UPS Ground 7 Days&L_SHIPPINGOPTIONNAME0=Ground&L_SHIPPINGOPTIONISDEFAULT0=false
&INSURANCEAMT=1.00&INSURANCEOPTIONOFFERED=true&CALLBACK=https://www.ppcallback.com/callback.pl
&SHIPPINGAMT=8.00&SHIPDISCAMT=-3.00&TAXAMT=2.00
And make sure your total amount is exactly equal to item amount
$nvpstr.="&MAXAMT=".(string)$maxamt."&AMT=".(string)$amt."&ITEMAMT=".(string)$itemamt;

I want to show shipping info in pypal but do not want to charge for shipping in paypal
=> Not prompt payers for shipping address in paypal. Accepted values:
0 – prompt for an address, but doesn't require one
1 – do not prompt for an address
2 – prompt for an address, and require one(set as necessary field)

I want to show shipping address and charge in paypal and want to charge for shipping in paypal
=> Use &SHIPPINGAMT=## parameter in $nvpstr and &NOSHIPPING=0. Make sure your total amount is equal to sum of item amount and shipping charge.

How to Add my Logo in paypal page during payment
=> Add &LOGOIMG=https://www.../YourLogo.gif in $nvpstr variable.

Where from i know Key Pair value parameter detail?
=> Click here to to get detail of all parameter used in Express Checkout

What is DoExpressCheckoutPayment and SetExpressCheckout
=> In order to use Express Checkout, you would call SetExpressCheckout API. where you specify the details of the products, amounts, and the RETURNURL.
Once the buyer agreed to your purchase, he/she is redirected back to the RETURNURL URL you specified.
Now you show the order confirmation, and call the GetExpressCheckoutDetails API
When calling GetExpressCheckoutDetails, supply the token. In the GetExpressCheckoutDetails API response you'll find a PayerID.
Now you're ready to call DoExpressCheckoutPayment, and charge the buyer. Remember to include both the token and the payerID when calling DoExpressCheckoutPayment.

Security header is not valid
=> Check your API_ENDPOINT and PAYPAL_URL variable string. For Live transaction there should not be ".sandbox" in both string.

More about Paypal Error & Solutions are here.

No comments:

Post a Comment