Paypal payment create parameters - paypal

what data can I, should I, must I, place in a create payment body with intent: sale and payment method : paypal? I specifically am looking for how to detail the one or more items the payment covers. But other useful inclusions would also be welcome.
Thanks

If you are looking to send multiple items to paypal you can use cmd="_cart" (if using name-value-pair)irrespective of language you use to talk to paypal, but this is not valid in case of REST I guess.
<input type="hidden" name="cmd" value="_cart">
Check this link if helps: Paypal

Related

PayPal does not return transaction information

I'm trying to integrate PayPal on my site and I have problems with receiving information from PayPal about transaction.
I'm using sandbox environment for tests.
I generated the form and placed return url into there:
<input type='hidden' name='return' value='my-local-site/success.php'>
After all payments are done (and they are done correct - I'm getting money to my account) I'm returned to my-local-site/success.php without any parameters about this transaction.
I tried to make it like here - http://www.dollarfry.com/paypal-integration-guide-php/ but it does not work for me.
My question is why I don't receive any information about transaction from PayPal as payments were done correctly via sandbox (money were sent from one account to another correctly).
I want to get some info like
http://my.local.site/success.php?tx=6BC88318RN685282M&st=Completed&amt=20.00&cc=USD&cm=&item_number=BEAR05
What should I do to get that info? Is something wrong I do, or with my account?
Thank you!
Try adding an extra parameter.
<input type="hidden" name="rm" value="0" />
Check PayPal's HTML variables documentation for more details. Search for "return method" on that page and you should find it easily.

Is there a way to collect address info via Paypal donation IPNs

I've got a scenario where I need to collect address details from Paypal when a user donates to a site. From what I can tell in the Paypal Sandbox those details aren't returned via IPN or PDT when the transaction is related to a donation.
Is there something I'm missing like an account setting or paypal variable that can make this possible?
At the moment I'm using a Buy Now option as below which does return address details:
input type="hidden" name="cmd" value="_xclick"
Simply changing the cmd to donation and the address info stops coming in via IPN:
input type="hidden" name="cmd" value="_donations"
I don't believe the address is given on donations. Your best bet is to call it a donation in the title & then send it still as an xclick. Change the displayed button image to a donation button, but use an xclick instead of _donation. I believe that's the only possible way.

Why is DoExpressCheckoutPayment required for Paypal?

I am trying to build a very simple paypal-backed shopping cart so users can purchase multiple items. I want paypal to handle all the payment details. I don't even want an order confirmation. I will manually check for order confirmation on paypal.
At first I wanted to use "Website Payments Standard" because it seemed easy to create a form that will post to paypal and let paypal handle it from there. But no, this did not work because the "Website Payments Standard" buttons/form do not support submitting multiple items. I tried all sorts of key/value in my form, and it never worked.
Then I tried Express Checkout using the instructions found here. It largely worked, but as I understand it, after sending a SetExpressCheckout, you have to listen for a request from paypal and do a DoExpressCheckoutPayment to complete the transaction. SO reference.
I find this a bit troublesome, because what if my server fails to receive the request from paypal and I never send a DoExpressCheckoutPayment? So a customer THINKS they have finished submitting an order, but the order was never received.
Does anyone know of a way to skip this "confirmation" step? I find it unnecessary, and not sure why paypal requires it.
That's because Express Checkout and Website Payments Standard are fundamentally different products.
To use Express Checkout, you would call the SetExpressCheckout API. In the API call, you specify the details of the products, amounts, and the RETURNURL.
Once you post this data to PayPal's API endpoint, you receive a token in return.
You would then redirect the buyer, and append the token to the following URL: https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-XXXXXXX
Once the buyer has agreed to your purchase, he is redirected back to the URL you specified in the RETURNURL.
You should now 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.
Note: If you want to charge the buyer immediately by calling GetExpressCheckoutDetails and DoExpressCheckoutPayment immediately, redirect the buyer to https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-XXXXXXX&useraction=commit.
The useraction=commit will change the "Continue" button on the PayPal 'Review your payment' page to a "Pay now" button.
--
The reason there's such a significant difference between Express Checkout and Website Payments Standard, is that Website Payments Standard is intended to be a drop-in working solution where PayPal handles the whole transaction flow. Express Checkout is a more flexible solution which allows you to integrate it deeply with an existing checkout flow of a website / shopping cart.
For your use case; lookat using PayPal 'cart upload' buttons.
See for an example https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_cart_upload
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="seller#designerfotos.com">
<input type="hidden" name="item_name_1" value="Item Name 1">
<input type="hidden" name="amount_1" value="1.00">
<input type="hidden" name="item_name_2" value="Item Name 2">
<input type="hidden" name="amount_2" value="2.00">
<input type="submit" value="PayPal">
</form>
Note however, that this is insecure by default, as the amounts you're going to charge will be plainly visible in the HTML.
** The PayerID is appended in the GET of your RETURNURL as well. So you could skip calling GetExpressCheckoutDetails if you wanted to.
For the purposes of this site, the DoExpressCheckoutPayment operation simply is required by the PayPal Express Checkout API.
You're correct that it's not required for PayPal to process a payment, but there are scenarios that would require a second operation. An example of such a scenario would be one where the user (your site's customer) is choosing a shipping address during the PayPal payment confirmation. Depending on your shipping provider(s), you may need to calculate actual shipping amounts after the user has chosen a shipping address on the PayPal confirmation pages.

simple website interface with PayPal with _xclick

ok, it's working. However, I need one thing fixed:
how to remove the shipping to field for in our case it's not needed. thanks.
Pass in no_shipping=1 (if you're using Website Payments Standard).
E.g. <input type="hidden" name="no_shipping" value="1">
For Express Checkout, you'd add NOSHIPPING=1 in your SetExpressCheckout API call.

multiple paypal donate button

I am building a web site for an organisation. The organisation can create as many programs as they want.
Each program should have a paypal donate button. when creating a program, a paypal donate button can be inserted automatically (something like {donate_button: label } ).
i want to keep track of each program donation fees.
So i need somehow to know what program a donor donate to so then i can make a report about fee for each program.
Am not so sure how to get this done properly. is it possible to add some parameters in the donate paypal button dynamically ? if posible , is there any problem regarding to security ?
Can paypal donate button be created dynamically ?
I am very appreciated for all of you .
Thanks
Am sorry for my bad English.
I'd suggest looking at Instant Payment Notification (IPN) and 'custom' to pass the name of the organisation on to PayPal.
Simply include the following in your existing button code
<input type="hidden" name="notify_url" value="link to IPN script">
<input type="hidden" name="custom" value="name of organisation / other unique identifier">
and read the IPN POST for the 'custom' parameter when it comes through.
There's additional documentation and some sample code at https://www.paypal.com/ipn