this is first time i'm develope paypal form , i have problem with shipping address how to get shipping address from customer and in email(see attach below) i want to insert into email from paypal ?
i don't know how to pass shipping address value.
There are mainly 10 hidden variables which we've to pass to PayPal for Payment related process mentioned as below (this method is very Basic PayPal Payment option, apart from it PayPal provides few other payment options as well):
<input type="hidden" name="business" value="Merchant Account Email Address here">
<input type="hidden" name="notify_url" value="http:// some url for notification purpose">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Item name here">
<input type="hidden" name="custom" value="PayPal will return this value as it is in the same format, when it is in sending time, like some array values concat with some special character">
<input type="hidden" name="amount" value="Payment Amount here as decimal for ex. 50.00">
<input type="hidden" name="return" value="http:// return url here, after payment to our website">
<input type="hidden" name="type" value="paynow">
<input type="hidden" name="cmd" value="_xclick">
You can just send above hidden variables to PayPal and set required URL as per your demo server website path.
Keep in mind to keep developer.paypal.com account logged in while you're checking with PayPal Sandbox (test mode) account. It will be required.
Thanks !
Related
I've created custom PatPal button code.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="from-to#from-to.com">
Price:
<input name="amount" type="number" step="0.01" value="1.00"> GBP
<br/><br/>
Name/Service Description:<br/>
<textarea cols="40" rows="5" style="width:400px;height:200px;word-break: break-word;" required name="item_name"></textarea>
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="notify_url" value="https://fromtotranslations.com/?wp_paypal_ipn=1">
<input type="hidden" name="bn" value="WPPayPal_BuyNow_WPS_US">
<br/><br/><br/>
<input type="image" style="max-width:200px" src="https://i.ibb.co/YcBX3Ww/paypall-button.png" border="0" name="submit">
I wanted to add user possibility of enter price manually.
Form seems to be working okay. Payment was made.
But I haven't it on my PayPal dashboard.
As customer I have notification, that seller have to confirm payment.
It seems, that PayPal not recognizes my email as PayPal account or maybe i don't know where to accept payment from customer.
Can You help me?
Is from-to#from-to.com your PayPal business account's primary email address?
Maybe try replacing this value with the one that points to the business account where you want to be receiving the PayPal payment.
Meanwhile, it would seem that there is no PayPal business account associated with the email from-to#from-to.com, and so that is why no one has accepted the payment. If no one registers that email with PayPal to accept it, it will be automatically refunded in 30 days.
Hi guys hope you are all safe. i just want to know that how can i switch sandbox account to live account.
First i was using https://www.sandbox.paypal.com/cgi-bin/webscr in paypal form action but when i go to live i changed it into https://www.paypal.com/cgi-bin/webscr
i also changed the business attribute in form to Paypal live business account.
right now PayPal is accepting the payment which is coming from website but when it redirects to my website paypal_success(page after payment success) page i cant able to get return values from Paypal like transaction id, item value, item name etc.
Can you please help me. here is my code.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" class="float-right w_100">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="business#awakeningsme.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Awakenings Products">
<input type="hidden" name="item_number" value="<?php echo $pro_id ?>">
<input type="hidden" name="amount" value="<?php echo $total; ?>">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="http://mywebsite.com/paypal_success.php">
<input type="hidden" name="cancel_return" value="http://mywebsite.com/paypal_cancel.php">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/buy-logo-large.png" alt="Buy now with PayPal" border="0" name="submit">
</form>
A more important issue is that PDT should never be used for anything important. It is for informational purposes only (e.g. to show a success page to the buyer)
If you depend on the information from PDT to trigger business logic like updating order records, you are going to have a bad time. After a successful Payments Standard payment, the customer may never return.
Their browser may crash, or they may be shown a receipt at PayPal and need to click a button to return, and so just close the window.
If you need reliable notifications of payment completion, your options are:
Implement a separate asynchronous service, such as Webhooks or IPN.
Switch to an API-based integration that is notified synchronously when the capture is successful, such as a server-side integration of v2/orders with Smart Payment Buttons (front-end code: https://developer.paypal.com/demo/checkout/#/pattern/server ). This way, the capture happens on your server, and you have an immediate API notification of success/failure
I am using paypal payment gateway with my website for payment.
Here I want a feature like where I could send list of product id those I want to purchase.
And after successful payment I want to these all id so that I could update my datasbe.
I can not use IPN, because its already used for other site.
Below is my html form for paypal..
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="praveend06-facilitator#gmail.com">
<input type="hidden" name="item_name" value="PAYMENT REASON">
<input type="hidden" name="amount" value="10">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="MX">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="hidden" name="notify_url" value="http://localhost/paypal/notify.php">
<input type="hidden" name="return" value="http://localhost/paypal/success.php">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cbt" value="Return to The Store">
<input type="hidden" name="cancel_return" value="http://localhost/paypal/fail.php">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
I wrote below code in success.php
but its returning blank array. Even i didn't get transaction id.
Please help me to achieve this. Thank you
There is only one parameter that you can use for custom data with Website Payments Standard and that's "custom".
Simply pass in you custom data in
<input type="hidden" name="custom" value="your custom data here">
In the custom data, first add the product IDs as a comma separated string and then you will get that back on successful payment.
You can retrieve the value for 'custom' by polling through PayPal PDT (https://www.paypal.com/pdt/) or getting the data POST'ed to you by PayPal, using PayPal IPN (https://www.paypal.com/ipn/).
But you already mentioned that you cannot use IPN. So go for PDT instead.
PDT is NOT the recommended way to update your database. Even with Auto-Return enabled there is no guarantee the user would make it back to your site. In these cases the return page would never be reached and that code would never run, leaving your database without the updates it needs.
You CAN use IPN with multiple PayPal accounts. You just need to use the notify_url parameter to specify the unique URL you want to use for IPN on that particular checkout.
On that note I see you're already including the notify_url parameter in your code here, but you're using localhost for it. That won't work because it will be PayPal's server sending data to that URL. As such, "localhost" is their own server at that point.
What you need to do for testing purposes is use your public IP address or setup a domain to resolve to your IP address so you can use that as your IPN URL instead of localhost.
So then, again, you can use as many different IPN URL's with a single account as you need to. Just set notify_url to whichever one you need to use based on the checkout that you're setting up.
The following is the simplest PayPal interface form:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" />
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="JohnDoe2#example.com" />
<input type="hidden" name="item_name" value="Purchase at the Virtual Store" />
<input type="hidden" name="item_number" value="Organic-001" />
<input type="hidden" name="amount" value="17.4" />
<input type="hidden" name="currency_code" value="EUR" />
<input type="hidden" name="notify_url" value="http://www.example.com/paypalnotify.php" />
<input type="submit" name="submit" value="Pay now By PayPal" />
</form>
This form is specific to a PayPal premier business account and a given amount to pay, with following key parameters:
business=JohnDoe2#example.com.
amount=17.4EUR.
currency_code=EUR or USD.
notify_url as the callback for PayPal.com as it ends.
By clicking on the [submit] button, it perfoms this:
It redirects the customer to the paypal.com site.
The user will login into her/his PayPal account, and validate the payment.
The PayPal site will call the paypalnotify.php like a callback, passes information indicating if the payment has suceeded, cancelled, or not valid...
Now in the new interface using PalPal REST API, using PHP development kit, how one has to proceed to accomplish the payment ?
There are a few options. Start by looking at the code in these files:
https://github.com/paypal/rest-api-sdk-php/blob/master/sample/payments/CreatePayment.php
https://github.com/paypal/rest-api-sdk-php/blob/master/sample/payments/CreatePaymentUsingPayPal.php
Obviously they don't have any interactive forms, but they show the general process. Dig in and work through creating your code. Then when you hit problems, open a new question with the specific issues. StackOverflow is not for "how do I" type questions. https://stackoverflow.com/help/on-topic
How do I integrate a one time fee into paypal?
The user clicks SignUp then is taken to a page to confirm t&c's and where they pay £50, they are then - if successful, taken to a page where they can enter details and create an account... but I only want this page to be visible to users coming from paypal.
I thought about using tokens, but I do not know how to use them.
You can use the paypal IPN which they are plenty of code samples and the paypal sandbox has some great tools to get you started.
The flow would work like this.
User selects that they want to sign up on your site and they fill out a form (contact info, accept terms and conditions, etc).
They then click purchase registrations, etc.
Your site posts all the details of the contact form along with the cost of registration to Paypal for the user to pay.
The user completes payment on the paypal site and is taken to a success page which informs them they will shortly receive an email regarding their registration.
Your back end...
1. After the user pays, paypal will post the details of the transaction to a URL you provide.
2. Your system completes a handshake over a connection to paypal.
3. Paypal sends the details of the transaction back to your server and you validate the total and any other necessary validations.
4. After validation, you system generates an email to the new user with their account details.
Let me know if that does not make sense or what additional elaborations are needed. Also if you let me know what language your coding in, I can pull up some sample code for you.
[EDIT]
Here is a URL to the paypal IPN --> https://www.paypal.com/ipn
--Dan
[edit]
Here is an example form. This form posts a single item for payment to paypal.
<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<input type="hidden" name="rm" value="2" id="PayPalRm" />
<input type="hidden" name="cmd" value="_xclick" id="PayPalCmd" />
<input type="hidden" name="business" value="seller#paypal.account" id="PayPalBusiness" />
<input type="hidden" name="return" value="http://localhost/inventories/success" id="PayPalReturn" />
<input type="hidden" name="cancel_return" value="http://localhost/inventories/cancel" id="PayPalCancelReturn" />
<input type="hidden" name="notify_url" value="http://localhost/Paypal_orders/process" id="PayPalNotifyUrl" />
<input type="hidden" name="item_name" value="product name" id="PayPalItemName" />
<input type="hidden" name="quantity" value="1" id="PayPalQuantity" />
<input type="hidden" name="no_shipping" value="2" id="PayPalNoShipping" />
<input type="hidden" name="shipping" value="2.5" id="PayPalShipping" />
<input type="hidden" name="shipping2" value="2.5" id="PayPalShipping2" />
<input type="hidden" name="no_note" value="1" id="PayPalNoNote" />
<input type="hidden" name="lc" value="US" id="PayPalLc" />
<input type="hidden" name="country" value="US" id="PayPalCountry" />
<input type="hidden" name="bn" value="PP-BuyNowBF" id="PayPalBn" />
<input type="hidden" name="amount" value="12" id="PayPalAmount" />
<div class="submit"><input type="submit" value="Click Here" /></div></form>