I do not know if the issue is in code or the paypal account settings. Paypal displays correctly the shipping cost, it displays the correct total (item price + shipping),
but in fact, the transactions includes only the item price, not the shipping costs.
I have been unable to find out what is wrong. if paypal can display it correctly, why cant it include it properly in the transaction ?
here is the request sent to paypal:
$padata = '&CURRENCYCODE='.urlencode($PayPalCurrencyCode).
'&PAYMENTACTION=Sale'.
'&ALLOWNOTE=1'.
'&PAYMENTREQUEST_0_CURRENCYCODE='.urlencode($PayPalCurrencyCode).
'&PAYMENTREQUEST_0_AMT='.urlencode($TotalPrice).
'&PAYMENTREQUEST_0_ITEMAMT='.urlencode($ItemTotalPrice).
'&L_PAYMENTREQUEST_0_QTY0='. urlencode($ItemQty).
'&L_PAYMENTREQUEST_0_AMT0='.urlencode($ItemPrice).
'&PAYMENTREQUEST_0_SHIPPINGAMT='.urlencode($deliveryCost).
'&L_PAYMENTREQUEST_0_NAME0='.urlencode($ItemName).
'&L_PAYMENTREQUEST_0_NUMBER0='.urlencode($ItemNumber).
'&AMT='.urlencode($ItemTotalPrice).
'&RETURNURL='.urlencode($PayPalReturnURL ).
'&CANCELURL='.urlencode($PayPalCancelURL);
The param for shipping that I used is :
PAYMENTREQUEST_0_SHIPPINGAMT
is it correct ? is a complementary one needed ?
Are you supplying all of your PAYMENTREQUEST_0_* and L_PAYMENTREQUEST_0_* variables in your DoExpressCheckoutPayment call as well as your SetExpressCheckout call?
SetExpressCheckout will control what the buyer sees when they go to check out on PayPal. DoExpressCheckoutPayment will control what the buyer is actually charged for. Therefore, if you want your shipping charge to be included in the transaction, you need to make sure that it's included in both calls.
for the records, correct params for DoExpressCheckoutPayment :
$padata = '&TOKEN='.urlencode($token).
'&PAYERID='.urlencode($playerid).
'&PAYMENTACTION='.urlencode("SALE").
'&PAYMENTREQUEST_0_CURRENCYCODE='.urlencode($PayPalCurrencyCode).
'&PAYMENTREQUEST_0_SHIPPINGAMT='.urlencode($deliveryCost).
'&PAYMENTREQUEST_0_AMT='.urlencode($TotalPrice).
'&PAYMENTREQUEST_0_ITEMAMT='.urlencode($ItemTotalPrice).
'&CURRENCYCODE='.urlencode($PayPalCurrencyCode);
Related
I am using PayPal Express checkout for payment. I need the SALUTATION of the user along with other shipping details. But it seems that only FIRSTNAME and LASTNAME are got from the response. What should be done to get the SALUTATION in the response as well.
This is the response got from GetExpressCheckoutDetails
TOKEN:EC%2d9F317807RE7947807
BILLINGAGREEMENTACCEPTEDSTATUS:0
CHECKOUTSTATUS:PaymentActionCompleted
TIMESTAMP:2016%2d05%2d12T11%3a54%3a16Z
CORRELATIONID:c50a6ba8b3002
ACK:Success
VERSION:93
BUILD:000000
EMAIL:nihal%40gmail%2ecom
PAYERID:2CLDDRMSKLDMA
PAYERSTATUS:unverified
FIRSTNAME:Nihal
LASTNAME:Mohammad
COUNTRYCODE:IN
SHIPTONAME:Nihal
SHIPTOSTREET:Chakkorathukulam
SHIPTOSTREET2:Nadakkavu
SHIPTOCITY:Calicut
SHIPTOSTATE:KOZHIKODE
SHIPTOZIP:670006
SHIPTOCOUNTRYCODE:IN
SHIPTOCOUNTRYNAME:India
ADDRESSSTATUS:Unconfirmed
CURRENCYCODE:USD
AMT:10%2e00
SHIPPINGAMT:0%2e00
HANDLINGAMT:0%2e00
TAXAMT:0%2e00
INSURANCEAMT:0%2e00
SHIPDISCAMT:0%2e00
PAYMENTREQUEST_0_CURRENCYCODE:USD
PAYMENTREQUEST_0_AMT:10%2e00
PAYMENTREQUEST_0_SHIPPINGAMT:0%2e00
PAYMENTREQUEST_0_HANDLINGAMT:0%2e00
PAYMENTREQUEST_0_TAXAMT:0%2e00
PAYMENTREQUEST_0_INSURANCEAMT:0%2e00
PAYMENTREQUEST_0_SHIPDISCAMT:0%2e00
PAYMENTREQUEST_0_TRANSACTIONID:2KR64654T7820071F
PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED:false
PAYMENTREQUEST_0_SHIPTONAME:Nihal
PAYMENTREQUEST_0_SHIPTOSTREET:Chakkorathukulam
PAYMENTREQUEST_0_SHIPTOSTREET2:Nadakkavu
PAYMENTREQUEST_0_SHIPTOCITY:Calicut
PAYMENTREQUEST_0_SHIPTOSTATE:KOZHIKODE
PAYMENTREQUEST_0_SHIPTOZIP:670006
PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE:IN
PAYMENTREQUEST_0_SHIPTOCOUNTRYNAME:India
PAYMENTREQUEST_0_ADDRESSSTATUS:Unconfirmed
PAYMENTREQUESTINFO_0_TRANSACTIONID:2KR64654T7820071F
PAYMENTREQUESTINFO_0_ERRORCODE:0
In PayPal documentation they say it is available in response.
see here
Its a simple problem. I was using the merchant account for US region. And the US region does not need the SALUTATION part for their address. That was why the response was not returning the salutation part i guess.
I'm using PayPal Express Checkout on a sandbox account, and i'm trying to link up the Unique Transaction ID on the "customer" paypal site with the completed transaction via Express Checkout.
My DoExpressCheckoutPayment returned:
TOKEN=EC%2d2KG36160AM8868619&
SUCCESSPAGEREDIRECTREQUESTED=false&
TIMESTAMP=2015%2d01%2d29T09%3a45%3a09Z&
CORRELATIONID=44060412ed341&
ACK=Success&
VERSION=93&BUILD=15009693&
INSURANCEOPTIONSELECTED=false&
SHIPPINGOPTIONISDEFAULT=false&
PAYMENTINFO_0_TRANSACTIONID=011446947E558235S&
PAYMENTINFO_0_TRANSACTIONTYPE=expresscheckout&
PAYMENTINFO_0_PAYMENTTYPE=instant&
PAYMENTINFO_0_ORDERTIME=2015%2d01%2d29T09%3a45%3a08Z&
PAYMENTINFO_0_AMT=7%2e98&
PAYMENTINFO_0_FEEAMT=0%2e47&
PAYMENTINFO_0_TAXAMT=0%2e00&
PAYMENTINFO_0_CURRENCYCODE=GBP&
PAYMENTINFO_0_PAYMENTSTATUS=Completed&
PAYMENTINFO_0_PENDINGREASON=None&
PAYMENTINFO_0_REASONCODE=None&
PAYMENTINFO_0_PROTECTIONELIGIBILITY=Ineligible&
PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE=None&
PAYMENTINFO_0_SECUREMERCHANTACCOUNTID=W9SM36U76AXSS&
PAYMENTINFO_0_ERRORCODE=0&
PAYMENTINFO_0_ACK=Success
Then my GetExpressCheckoutDetails returned:
TOKEN=EC%2d2KG36160AM8868619&
BILLINGAGREEMENTACCEPTEDSTATUS=0&
CHECKOUTSTATUS=PaymentActionCompleted&
TIMESTAMP=2015%2d01%2d29T09%3a45%3a33Z&
CORRELATIONID=80e00a0067bea&
ACK=Success&
VERSION=93&
BUILD=15009693&
EMAIL=test1%40sud%2eco2euk&
PAYERID=H54VEN293PLFL&
PAYERSTATUS=verified&
FIRSTNAME=Test&
LASTNAME=User&
COUNTRYCODE=GB&
CURRENCYCODE=GBP&
AMT=7%2e98&
SHIPPINGAMT=0%2e00&
HANDLINGAMT=0%2e00&
TAXAMT=0%2e00&
INSURANCEAMT=0%2e00&
SHIPDISCAMT=0%2e00&
PAYMENTREQUEST_0_CURRENCYCODE=GBP&
PAYMENTREQUEST_0_AMT=7%2e98&
PAYMENTREQUEST_0_SHIPPINGAMT=0%2e00&
PAYMENTREQUEST_0_HANDLINGAMT=0%2e00&
PAYMENTREQUEST_0_TAXAMT=0%2e00&
PAYMENTREQUEST_0_INSURANCEAMT=0%2e00&
PAYMENTREQUEST_0_SHIPDISCAMT=0%2e00&
PAYMENTREQUEST_0_TRANSACTIONID=011446947E558235S&
PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED=false&
PAYMENTREQUESTINFO_0_TRANSACTIONID=011446947E558235S&
PAYMENTREQUESTINFO_0_ERRORCODE=0
But the customer site says:
PayPal Express Checkout Payment Sent (Unique Transaction ID 7PK53077PJ222701T)
Oh..the (painful) memories :) That aforementioned "oddity" also exists elsewhere - e.g. eBay transactions
IINM, you'll need to send your own "custom ID" - the Invoice Id mentioned above (which is displayed to the end user) so both ends have some visual reference to a transaction.
In the REST API (unsure in Classic, haven't tried), if you send an Order, the Order Number (finally) is shared on both ends (same for both). Though it wouldn't hurt to still send your own "custom Id"/"Invoice Id".
Buyer/Customer Paypal UI:
Seller/Merchant Paypal UI:
Hth...
I'm building a book store and I am building the checkout using PayPal Payflow . This is the checkout flow:
Shipping info --> Billing info |verify CC using Paypal| --> Order summary --> Submit |authorize CC using Paypal|
Shipping info: fill out shipping address, nothing special here
Billing info: fill out your billing address + credit card info. Don't save the credit card info since it's against standards, instead just send the CC number, expiration date, and CVV directly to PayPal to verify. PayPal approves.
Order summary: The order sees the summary of his order before he submits the order. He presses submit and another request to PayPal is sent to authorize the funds.
However, the CC info vanishes after #2, so how would I persist that data to #3 so that I can send it to PayPal again?
Can I just use the ORIGID to point to the PNREF ? The documentation says I have to do a full request with the whole params list (including CC info, CVV, exp date, etc).
TRXTYPE=A&TENDER=C&PWD=x1y2z3&PARTNER=PayPal&VENDOR=SuperMerchant&USER=S
uperMerchant&ACCT=5555555555554444&EXPDATE=0308&AMT=123.00&COMMENT1=Seco
nd purchase&COMMENT2=Low risk customer&INVNUM=123456789&STREET=5199
MAPLE&ZIP=94588
Or am I just misunderstanding what authorization means? Isn't authorization actually reserving funds in the user's CC? So that shouldn't be done until the user presses submit order right?
I figured it out.
The documentation here: https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/pp_payflowpro_guide.pdf
on page 40 mentions it briefly, but doesn't go into much detail about this checkout flow even though it seems pretty common.
My assumption was right, in that I could just do an address verification request first with all the CC info, and use the PNREF returned. I save the PNREF id in my session and reuse it to submit a request that looks like this:
def authorize_transaction(pnref)
make_request(authorization_data(pnref))
end
def authorization_data(pnref)
{
"TRXTYPE" => "A",
"TENDER" => "C",
"USER" => PAYPAL_API["user"],
"PWD" => PAYPAL_API["pwd"],
"VENDOR" => PAYPAL_API["user"],
"PARTNER" => "Paypal",
"AMT" => purchase.total_price,
"ORIGID" => pnref,
"VERBOSITY" => "HIGH"
}
end
And receive the desired response:
{"RESULT"=>"0", "PNREF"=>"A10A6A9C08E1", "RESPMSG"=>"Approved", "AUTHCODE"=>"752PNI", "AVSADDR"=>"Y", "AVSZIP"=>"Y", "HOSTCODE"=>"A", "PROCAVS"=>"Y", "VISACARDLEVEL"=>"12", "TRANSTIME"=>"2014-01-31 11:53:56", "FIRSTNAME"=>"net", "LASTNAME"=>"theory", "AMT"=>"15.64", "ACCT"=>"1111", "EXPDATE"=>"0115", "CARDTYPE"=>"0", "IAVS"=>"N"}
I user PayPal's Express Checkout API to make an parallel Payment. Everything works fine, on the payee site, the 2 payments are booked as "open".
While DoExpressCheckoutPayment I get an transaction id for each payment. But a doCapture fails with "You%20do%20not%20have%20permissions%20to%20make%20this%20API%20call". A single authorized payment that I made several weeks ago but have never captured gives me just "Order%20has%20expired%2e" - which is fine.
I use the following parameters for the NVP API:
$parameters = array("METHOD"=>"DoCapture",
"AUTHORIZATIONID"=>$transactionid_item,
"AMT"=>$amt_item,
"CURRENCYCODE"=>$currencycode,
"COMPLETETYPE"=>"Complete"
);
when of course the variable are the corresponding values to each payment. (plus authentication/api credential).
What am I doing wrong? Is there an additional variable to set when I make a parallel instead of an single payment?
regards,
chris
This is an example call and the response:
https://api-3t.sandbox.paypal.com/nvp?METHOD=DoCapture&AUTHORIZATIONID=O-67121848EA448750G&AMT=9.70&CURRENCYCODE=EUR&COMPLETETYPE=Complete&USER=xxx&PWD=xxx&SIGNATURE=xxx&VERSION=95.0
array(9) {
["TIMESTAMP"]=>
string(28) "2013%2d06%2d15T09%3a35%3a52Z"
["CORRELATIONID"]=>
string(12) "140dec053198"
["ACK"]=>
string(7) "Failure"
["VERSION"]=>
string(6) "95%2e0"
["BUILD"]=>
string(7) "6444009"
["L_ERRORCODE0"]=>
string(5) "10007"
["L_SHORTMESSAGE0"]=>
string(19) "Permission%20denied"
["L_LONGMESSAGE0"]=>
string(67) "You%20do%20not%20have%20permissions%20to%20make%20this%20API%20call"
["L_SEVERITYCODE0"]=>
string(5) "Error"
}
It looks like you are running your Express Checkout API call as an order, then you are turning around and doing a DoCapture request but you are passing over the order id for the auth id instead of the authorization id. If you are wanting to set your Express Checkout to be an order instead of an auth or a sale, then you need to perform the calls in the following ways.
SetExpressCheckout API call (processing as order)
GetExpressCheckoutDetail API Call
DoExpressCheckoutPayment API Call (processing as order)
DoAuthorization (performs an auth, and passes over the order id that you received from the EC flow)
DoCapture (performs a capture against the auth, you will pass over the auth id that was returned in the previous call here, not the order id)
I disovered a wired issue using Paypal ExpressCheckout with discounts:
I pass 2 Items like:
L_NAME0 : "test2",
L_AMT0: 2, // 2 EUR
L_QTY0: 1
and
L_NAME1 : "Discount",
L_AMT1: -0.60, // 60 cent
L_QTY1: 1
After redirect to Paypal everything seems fine:
But after closing this transaction, paypal charges the full amount (2 EUR) from my paypal-account:
What is wrong with this paypal discount? It seems to be cheating on the customer and he must feel betrayed.
I dont believe its paypals fault, so any ideas on what i did wrong are appreciated :)
It looks like you applied the discount line item to your SetExpressCheckout call, but the DoExpressCheckoutPayment call must not have had the same thing..??
You need to make sure DECP has all of the same line item details in it.