what is the meaning of PAYMENTREQUEST_n_AMT in SetExpressCheckout and DoExpressCheckoutPayment? - paypal

I am using ExpressCheckout and testing Paypal in the sandbox. I've noticed if I set a higher amount of PAYMENTREQUEST_n_AMT in DoExpressCheckoutPayment() then in SetExpressCheckout() (e.g. $30 USD in SetExpressChecout(), $50 USD in DoExpressCheckoutPayment()), Paypal will transfer $50 USD to my sandbox business account from my sandbox personal account.
Is it because this is a sandbox server or something I should know ?
I am constructing a website which is required to charge an advance from the buyer and collect what remains of the net price a few days later. If this is a feature of Paypal Express Checkout, I will set the amount of advance in SetExpressCheckout() and the total Net Price in DoExpressCheckoutPayment(). Thereafter, the buyer will only see the advance amount in Paypal to decrease the confusion. If we said we only charge the advance, but in Paypal show the total amount of net price, it might cause confusion.
In my test it works in the sandbox, but Paypal will reply SUCCESSPAGEREDIRECTREQUESTED=true in this situation. Paypal documentation explains "Flag to indicate whether you would like to redirect the buyer to sign up for PayPal after completing the transaction." What does that mean?
Could you please clarify this for me?

This is not the way to go about doing this, as DoExpressCheckoutPayment needs to be completed within three hours of SetExpressCheckout being called (and having generated a TOKEN). What you'll want to use is PayPal Authorization & Capture (see also here).
Call SetExpressCheckout and DoExpressCheckoutPayment with the total
amount you wish to charge and ensure you pass
PAYMENTREQUEST_0_PAYMENTACTION=Authorization in both.
Call DoCapture and run a partial capture on the transaction. By running a partial capture, you leave the remainder open to be captured at a later date (COMPLETETYPE=NotComplete)
Once you're ready to capture the remainder, call DoCapture again and set COMPLETETYPE=Complete. After it a capture is completed, you cannot capture any more funds from that specific transaction ID, regardless of whether or not you captured the full amount or not.

Related

Handling unknown shipping costs via PayPal Express nvp API

Can some confirm something for me; I've searched PayPal's docs and just can't find the answer.
If calling SetExpressCheckout with the parameter 'TOTALTYPE'= 'EstimatedTotal', how much headroom does PayPal allow for finalizing the transaction?
For example, someone carts an item that has a cost of $1. They click PayPal Express and get sent to PayPal to authorize an estimated amount of $1. Then they return to the merchant site and now that their address is known, the cart says shipping is +$20.
Is that acceptable? I'd really like to understand the groundrules on this, as I don't want to risk any authorization errors due to insufficient order amount when making the request.
Well, I have to answer my own question here. I called PayPal. The answer is "it's handled, don't worry about it". They would rather not publish the details on their proprietary algorithm because there are fraud tests, etc. going on -- but said it is a key design point for them and it is absolutely handled no worries.
If you are not passing a SHIPPINGAMT variable with the SetExpressCheckout call, then we will not display or "calculate" shipping on the PayPal page. When they are transferred to the PayPal page the customer is not authorizing the payment per se, rather they are selecting their payment method/funding source to be used when the DoExpressCheckout call is passed.
Only after the customer is transferred back to your page, and the final order total is known and passed via the DoExpressCheckout is the payment initiated. The difference between the total amount in the Set call and the Do call does not matter. Perhaps the agent with whom you were speaking with under the impression of an authorize/capture structure being in place. This will limit the final capture amount to the authorized amount +/- 20%.
Of course this is all turned on its head if you are passing the USERACTION=COMMIT variable which will "finalize" the payment on the PayPal page, while the DoExpress call is run transparently on your end. This will change the text on the button on the PayPal page to "Pay Now" instead of "Continue: You're almost done. You will confirm your payment on yourwebsitehere.com"
I hope this helps!

Paypal payment process in 2 step?

I want to make payment process in 2 step , in first step paypal should collect fund from user account but not transfer to the merchant account .
when i send another request with sucess action at that type paypal should transfer fund to merchant account or if i pass fail action then paypal should refund to user.
is there any way to do this ?
i reefer following URL but cant find solution .
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_WPECIntegration#id0861K0T0WY4
Express Checkout is what you want, but there's better documentation available.
Basically, what you're after is Authorization and Capture. When you create your Express Checkout API requests you'll set the PAYMENTACTION to Authorization. Then, when you're ready to process the payment you call DoCapture and pass in the transaction ID you get back from Express Checkout.
No money is processed until the DoCapture call is processed. If you don't end up needing to process it you can simply do nothing, but that would strand the authorization on the user's account for the default period of time depending on their bank. Usually 30 days.
It's a better practice to call DoVoid at that point, which would cancel the authorization and release those funds back to the user's account immediately.
If you want to do the same thing with credit cards directly you can use Payments Pro. The process is almost identical, except there are actually fewer calls involved.
If you're using PHP I would recommend taking a look at my PHP class library for PayPal. It'll make all of this very simple for you, and I can provide 30 min of free training to help you get going if you want, too.

Parallel preapproved paypal payment?

I have parallel payments working on my test server very nicely, i.e. I can send money to more than 1 person at a time in parallel based on the example parallel.php file I downloaded from the developer paypal site.
I also downloaded the preapproval_flow.php file, but in the code, I can't see a variable/array which allows me to set parallel payment receivers, or even a single receiver for that matter.
Is it not possible to preapprove parallel payments with paypal api's?
If it is possible, how do I do it?
With straight forward parallel payments, I can use the following to set the parallel receivers of a payment:
$receiverEmailArray = array(
'email0',
'email1',
'email2',
'email3',
'email4',
'email5',
'email6',
'email7',
'email8',
'email9'
);
According to cms.paypal.com and x.com, the preappoval_flow has an option called feesPayer, for which the documentation says:
SENDER – Sender pays all fees (for personal, implicit
simple/parallel payments; do not use for chained or unilateral
payments)
The bold bit, tells me that it's possible to do pre-approved parallel payments, but I can't figure out how to sent the receivers...
Also, on x.com, it says:
Developers and merchants can combine;
Parallel and preapproved payments.
The first step in pre-approvals, is on obtaining one from the buyer.
This pre-approval is not tied to any specific seller, but rather to the API caller, and it allows you to make a Pay API call in the future without the buyer having to confirm it.
The pre-approval flow is a separate API call from the Payment flow. In it, you specify the total amount you want to pre-approve, the start and end dates that the pre-approval is valid for, and a few other parameters. (See chapter 8 of the Adaptive Payments dev guide for the full spec: https://cms.paypal.com/cms_content/US/en_US/files/developer/PP_AdaptivePayments.pdf )
In this API call, you redirect the buyer to the PayPal site, where he will approve future payments up to the amount you specified. (e.g. if you specified a total amount of $1000, the buyer can make 20 purchases of $50, or 1 big purchase of $1000)
Once the buyer approves this, you have a permission to charge him (In the form of a pre-approval token PA-xxxxxxxxxxxxxx, but at this point no money has changed hands.
Now that you have the token, you can proceed to make the Parallel Payment Pay API call, just like you are doing now, BUT you will specify one additional parameter:
preapprovalKey=<The PA key obtained previously>
(And you also need to make sure that actionType is set to PAY )
As soon as you make this API call, because PayPal sees that you have already obtained permission from the buyer (in the form of the approved PA-key), it will immediately move the money to the receivers specified. There is no need for the buyer to be redirected to approve this payment, since he has already pre approved it. (See the logic here?)
So to recap:
Make call to Pre-Approval API, to obtain permission to charge from the buyer
Make call to Pay API (that includes the PA key from step 1) to execute on the permission given

For a Paypal IPN what's the difference between auth_amount and mc_gross?

I'm having a hard time finding this out from the documentation. I have some code I've inherited which needs to get he payment amount from a Paypal IPN transaction. It's expecting the variable "auth_amount" from a Paypal IPN but is not getting passed this field. It looks to me from the Paypal docs as though I should be using the field "mc_gross" which is labelled as "Full amount of the customer's payment, before transaction fee is subtracted.".
The Paypal IPN docs describe the "auth_amount" field as "Authorization amount", which doesn't mean much to me.
I'm going to change it to use mc_gross, but I just want to check first that I'm not missing something silly?
Thanks!
Check this out:
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables
mc_gross
Full amount of the customer's
payment, before transaction fee is
subtracted. Equivalent to
payment_gross for USD payments. If
this amount is negative, it signifies
a refund or reversal, and either of
those payment statuses can be for the
full or partial amount of the original
transaction.

Paypal Web Payments Buttons

My website allows people to "sign up" for day trips. They must then pay a price based on their selection. Does paypal allow you to send your own payment values (as calculated by the amount of daytrips and the price of each one)?
Is there a way to program this value?
Cheers,
Dan
Take a look # the Direct Payment API. I think it supports all your needs
https://www.paypal.com/cgi-bin/webscr?cmd=_dcc_hub-outside
Also, you can test your application in the PayPal Sandbox
https://developer.paypal.com/
How it works
For each payment, Direct Payment API
takes the billing address, transaction
amount, credit card information, and
item information as inputs. Within
seconds, the API returns a
confirmation that the transaction has
been processed.