PayPal custom button code. "User has to accept payment" - php

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.

Related

How to switch PayPal sandbox account to live account in PHP

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

paypal subscription error when doing the purchase on live site, but works on sandbox. "Action could not be completed"

I have 2 purchase button for paypal.
Regular checkout (this works perfectly well in sandbox AND live site)
A recurring payment.
The recurring button works perfectly well in the sandbox. I can make the transaction, no problem. Everything is good.
If I switch over the live site, my #1 (regular checkout button still works with a real money exchange), but my recurring button doesn't.
It Does bring me to the paypal subscription payment page. I use a paypal account with real live credits in it (NOT the same account as the seller's account). And when I press login, I see:
Sorry — your last action could not be completed
If you were making a
purchase or sending money, we recommend that you check both your
PayPal account and your email for a transaction confirmation after 30
minutes.
If you came to this page from another website, please return to that
site (don't use your browser's Back button) and restart your activity.
If you came from PayPal's website, click the PayPal logo in the
upper-left corner to return to our home page and restart your
activity. You might have to log in again.
I tried the following:
Change browser, FF and Chrome
Clear all cache, cookies
I am not using frames as other people have suggested
Nothing works.
here is my code to submit to paypal, in case someone sees a mistake:
<form name="_xclick" action="https://www.paypal.com/ca/cgi-bin/webscr" id="myform" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="MY EMAIL HERE">
<input type="hidden" name="item_name" value="MY NAME Subscription">
<input type="hidden" name="add" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="currency_code" id="currency" value="<?=$currency?>">
<input type="hidden" name="a3" id="hiddentotal2" value="<?=$total2?>">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<input type="hidden" name="src" value="1">
<input type="hidden" name="custom" id="custompaypal" value="<?=$custom?>">
<input type="hidden" name="notify_url" value="http://www.mysite..../notify_paypal.php">
<input type="hidden" name="return" value="http://www.mysite..../myorders.php">
<input class="submit-button2" type="submit" name="submit" value="PURCHASE SUB" />
</form>
What could be causing this and how can I fix this.

Currently PayPal accounts in India are only able to send payments. This recipient is not eligible to receive funds

I'm trying to payment from sandbox buyer account to sandbox business
account.
I got the error
Currently PayPal accounts in India are only able to send payments.
This recipient is not eligible to receivefunds.
This is my html form:
<form name="_xclick" action="https://www.sandbox.paypal.com/cgi-bin /webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="vpratap-facilitator#grepruby.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="quantity" value= "5">
<input type="hidden" name="amount" value="1">
<input type="hidden" name="shipping" value="0" />
<input type="image" src="http://www.paypal.com/en_GB/i/btn/x-click-but01.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and
secure!">
</form>
solution is create new account using Sandbox->Accounts->Create Account. Note the important part is to use United States in country.
There is no solution to this problem. For regulartory reasons PayPal is unable to offer full services (including receiving payments) in India at this time.

How to transform PayPal Classic Payment form into PayPal REST API PHP Application?

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 to pass shipping address value in paypal email?

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 !

Categories