how to create a payapal's payment form? - paypal

I want to create a form for paypal payment. like this form.
what i want is to make a simple paypal button. after clicking on that button this form will appear. but the problem is when ever I create get payment button , from my paypal account I end up with this kind of form.
how to get that form in paypal? thanks in advance.
in addition i got a project code. this code is a paypal button link up with a form like my first image.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="ZEFZFYBY2SZB8">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
when i make a button from my paypal account. after click that button i end up with the form like my second image. how do i create the form like first image.

Please Describe what kind of Script or CMS you are using is it PHP or HTML or .... ?
for Creating a button Login to your Paypal Account on Seller preferences and make the botton or find information Here
if you are using Wordpress and Woocommerce you can install plugins Here
if you are using PHP Scripts you can find Code Integration Here
UPDATE
Regarding your Type of Form you wanted you can download either one of the plugins written by Scott Paterson Below
https://en-gb.wordpress.org/plugins/contact-form-7-paypal-add-on/
https://en-gb.wordpress.org/plugins/easy-paypal-donation/
The First Plugin is the Form that you referred on your comments below
just leave the price and form empty

See following link which guides you to get started with using Paypal Payment Gateway :
https://phppot.com/php/paypal-payment-gateway-integration-in-php/

Related

Finding PayPal Buy Now Button redirection link

I am trying to make a program that can scrape a site and search for PayPal buy now button redirection links.
I can scrape the site but I realize that when you hit the button, it does not contain the URL that you will be redirected to make purchase. How would I go about finding the button redirection link, or even how would I have the site scrape and click on the button to at least have the redirect site appear? Would I somehow have to make the scraper hit the form and submit?
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input name="cmd" type="hidden" value="_s-xclick" /><br />
<input name="hosted_button_id" type="hidden" value="PUEGWVJXLH4FQ" /><br />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" type="image" /><br />
<img loading="lazy" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" alt="" width="1" height="1" border="0" /></form>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">_______________________________________________________</p>
</form>
Go to https://www.paypal.co/buttons, log in, and (after logging in) create a new simple Buy Now button with no dropdown options nor text fields (which require HTML) -- and once the button is created and you are viewing the generated code, switch over to the "E-mail" tab above it.
The link in that E-mail tab will have a hosted button ID, which you can swap out / use to dynamically generate the Buy Now "redirection link" you're asking for. When loaded in a browser, that link will initiate a checkout, same as clicking the button.
There are several other types of PayPal payment buttons, including:
Unhosted Buy Now buttons (which are not saved at PayPal, and do not have a hosted_button_id). These buttons use a redirection link or form post that will include HTML variables to set up the payment.
Newer smart buttons, generated via https://www.paypal.com/buttons/smart or similar -- these do not have redirection URL, and instead use JS to open a mini window for payment approval.
Another way to construct a working URL is to begin with the form's action parameter https://www.paypal.com/cgi-bin/webscr, add ? to begin a GET string, and add all the inputs from the form that have a name, in with the syntax name=value, separated by '&' .... so for example:
https://www.paypal.com/cgi-bin/webscr?hosted_button_id=PUEGWVJXLH4FQ&anothername=anothervalue&...

Paypal Returns Auth code only after Subscription completed?

I am trying to set up a subscription payment for Paypal. I am testing with the sandbox with the following code.
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<br/>
<input type="hidden" name="cmd" value="_s-xclick"><br/>
<input type="hidden" name="hosted_button_id" value="3PFTX58KDNXHQ"><br/>
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"><br/>
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"><br/>
</form>
Above code is a auto generated subxcription button code from my sandbox account.
It is working file with subscription in sandbox. I mean after the subscription complete it is showing right data in my sandbox account with the subscription information. But the problem is when the subscription is done and user got back to site is having a auth get parameter with it. like
http://my-site.com/this-subscribe-button-return-url.php?auth=[auth_code_from_paypal]&form_charset=UTF-8
Actually My return url is like the following
http://my-site.com/this-subscribe-button-return-url.php?status=success
I have my ipn enabled and its pointing to different url than return url.
What is this auth value? and what am I supposed to do with it?
I want the whole subscription data posted back when somebody completes his subscription process to a certain url (like notify_url). I have already set my notify_url in my ipn settings.
Please somebody give a proper solution to these problems. Thanks in advance.
How are you wanting to get the information back, or what method are you trying to use? If you wanting to get the information back and validate it, you want to use PDT. This will allow you to validate the information that is being sent over to you as well.

create buynow button for sandbox account

I'm new to paypal development and am trying to create a BuyNow button in the sandbox to enable me to test my application in a non production environment. If I create a button from my normal account it directs me to the live paypal site but if I try to create a button in the sandbox, the button creation page is always on the live box and I can't find anyway of creating a button in the sandbox using sandox test accounts, that then allows me to make test payments in the sandbox. Please help.
The link in the sandbox is broken and redirects you to the live site. When this happens, sometimes you can just add sandbox into the URL to correct the issue. So if you click the button and it takes you to https://www.paypal.com/button/blah_blah, you would just need to change it to https://www.sandbox.paypal.com/button/blah_blah. Another option would be to create a non hosted clear text button from your live paypal account and then just modify the URL to point to the sandbox instead of the live site. So instewad of the following:
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
You woudl just change it to
<form target="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
And then you would update the business variable to reflect the email address of your test sandbox seller account.
The last option for creating a button, would be not to log into your account but use the BMCreateButtom API call. Keep in mind this could be a little bit more work then you may want to do if you are only familar with HTML.
I faced the same problem..
when i click the "create payment buttons for your website" it redirects to this link www.paypal.com/us/webapps/mpp/standard-integration which is live paypal site. your test account does not exist there so you can not do the rest with the sandbox test account..
i solved it the follwing way..
after redirect to above link... you can edit the link.
put "sandbox." in the link. The edited link will be
www.sandbox.paypal.com/us/webapps/mpp/standard-integration
now you can create your customize button.. the generated HTML will be something like this
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="5GW6UJKLK47R6">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
I can't comment because my reputation isn't high enough, but I thought it was important to add this element to Sadid Khan's correct answer. When trying to change the address to the sandbox you need to add the 'www' in front of the subdomain.
sandbox.paypal.com will redirect to the frontpage/homepage for the sandbox.
www.sandbox.paypal.com will properly run the purchase emulation
You can set data-env="sandbox" to create a button which will redirect you to sandbox website.
<script type="text/javascript" charset="utf-8"
src="/assets/paypal-button.min.js?merchant={merchant-email}"
data-button="buynow"
data-name="My product"
data-amount="1.00"
data-env="sandbox"
></script>
In your sandbox account:
Click the Gear icon (Profile) on top right.
Then choose 'Business Setup',
Then 'On your website'
Then Option B to add a payment payment button.
You can choose between 'Buy Now' and 'Pay Now' in the advanced setting of the button.

PayPal encrypted button as text link

I use PayPal Api to create encrypted BuyNow buttons. The Api return button as form HTML code.
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIIWwYJKoZIhvcNAQcEoIIITDCCCEgCAQExggE6MIIBNgIBADCBnjCBmDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3NlMRUwEwYDVQQKEwxQYXlQYWwsIEluYy4xFjAUBgNVBAsUDXNhbmRib3hfY2VydHMxFDASBgNVBAMUC3NhbmRib3hfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMA0GCSqGSIb3DQEBAQUABIGAWicsbzx8E3DiwoiAmsPDgFMXMXw2Vv4brJMg0h+4q3XDYZIlUmqe68cz/G98LcdjCRPzdj8ysAL9omG+CajwB+6Lh1gU8XnqolRbY0qrj515o2aUbR4mIZnRVMpFakSuX/xB/yvy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sGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTIwODI5MDg1NTU1WjAjBgkqhkiG9w0BCQQxFgQUaBaJ4m2GzLbeacAcXs2DCghZIEgwDQYJKoZIhvcNAQEBBQAEgYB3vXv0Qlqda8ejg8FWLie/fvC9p8sk/TP+gBXnxi5sNPM0N9NTHp3Epu8qZR9FJVctrBkeF5BosIqhCfNe9HV12PFbv7N9jXSNJ8Dkr0TVtlAWhSmoeaDDHSm3uhYYJ4wcWImLSGufOdoE/cyGys8rxv7noJN6YjTfbgXbum9DZQ==-----END PKCS7-----
">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
The problem is that I do not want to use FORM for paypal buttons and also I do not find a way to change default paypal button which is embedded in form html code. I would like to use encrypted paypal button as simple text link.
I have tried to just copy all form variables and build url with parameters like
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_s-xclick&encrypted=-----BEGIN PKCS7-----MIIIWwYJKoZIhvcNAQcEoIIITDCCCEgCAQExggE6MIIBNgIBAD.....
Unfortunately it do not work. Maybe someone has solution?
In the BMCreateButton API call, instead of BUTTONTYPE=ENCRYPTED, set BUTTONTYPE=HOSTED. It will be the same security-wise, but it would also return an 'EMAILLINK', which you could then use.
BUTTONTYPE=ENCRYPTED unfortunately will not return an EMAILLINK.
Additionally, if you include the full encrypted text inside your link, you may well run into a LimitRequestLine limitation in Apache (default: 8190), depending on your Apache configuration.
It's just much, much better to keep the URL as short as possible.
You copied the link wrong. It will work fine.
However, a hosted button is much much much better. And editable via the ButtonManager API.
I had the same issue, I urlencoded the encrypted value and it worked. I hope this helps for anyone else having the same issue that does not want to use the API to make hosted buttons.

Submit Data and Redirect To Paypal

I have a form on my website. When this form is submitted ( to the same page ) , a file is uploaded and all the details in the form are entered into a database. Next thing is we need to redirect to paypal for payment. Whats the best way to design this?
My form has the following fields:
name, email, password, attached file
PayPal Submission form is like this
<form id="frm_paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="JDEC8Q72KAYRN">
<input type="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Note:
I am not being able to redirect to paypal with post data using header('paypalurl')
Ya you cant redirect using header() because you've already sent headers to the page.
So basically, what you can do is gather all the data you need to save in the DB and when they click 'Sign Up' send them to a 'Confirmation Page' that says "Please confirm what you entered, press Pay Now when ready". So it adds an additional click, but its a familiar flow for most checkout processes, so it shouldnt be inconvenient really.
i know this question is old, but maybe it helps someone who comes across this like myself...
alternatively, you do not output any form fields but do a header redirect like so
header('location: https://www.paypal.com/cgi-bin/webscr?'.http_build_query($varsToSendtoPaypal).'');
i know in the paypal documntation it is supposed to be a post request, but I have - as yet anyway - not have had any problems doing it this way (and it saves that additional click)
just a suggestion though