Old PayPal checkout page if using GET instead of POST
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using the following PHP code to encrypt the billing details I'm passing to PayPal:
<?php # private key file to use $MY_KEY_FILE = "my-prvkey.pem"; # public certificate file to use $MY_CERT_FILE = "my-pubcert.pem"; # Paypal's public certificate $PAYPAL_CERT_FILE = "paypal_cert.pem"; # path to the openssl binary $OPENSSL = "/usr/bin/openssl"; $form = array( 'cmd' => '_xclick', 'cert_id' => 'HSFU5KJLFS8JD', 'business' => 'test[et]example.com', 'currency_code' => 'EUR', 'no_shipping' => '1', 'charset' => 'utf-8', 'lc' => 'DE', 'item_name' => 'My test product', 'amount' => '4.20', 'return' => 'http://www.example.com/success.php', 'cancel_return' => 'http://www.example.com/error.php', ); $encrypted = paypal_encrypt($form); function paypal_encrypt($hash) { global $MY_KEY_FILE; global $MY_CERT_FILE; global $PAYPAL_CERT_FILE; global $OPENSSL; if (!file_exists($MY_KEY_FILE)) { echo "ERROR: MY_KEY_FILE $MY_KEY_FILE not found\n"; } if (!file_exists($MY_CERT_FILE)) { echo "ERROR: MY_CERT_FILE $MY_CERT_FILE not found\n"; } if (!file_exists($PAYPAL_CERT_FILE)) { echo "ERROR: PAYPAL_CERT_FILE $PAYPAL_CERT_FILE not found\n"; } $hash['bn']= 'StellarWebSolutions.PHP_EWP2'; $data = ""; foreach ($hash as $key => $value) { if ($value != "") { $data .= "$key=$value\n"; } } $openssl_cmd = "($OPENSSL smime -sign -signer $MY_CERT_FILE -inkey $MY_KEY_FILE "."-outform der -nodetach -binary <<_EOF_\n$data\n_EOF_\n) | "."$OPENSSL smime -encrypt -des3 -binary -outform pem $PAYPAL_CERT_FILE"; exec($openssl_cmd, $output, $error); if (!$error) { return implode("\n",$output); } else { return "ERROR: encryption failed"; } }; ?> <!DOCTYPE html> <html> <head> <title>PHP Sample Donation using PayPal Encrypted Buttons</title> </head> <body> <form action="https://www.paypal.com/cgi-bin/webscr" method="get"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="encrypted" value=" <?PHP echo $encrypted;?>"> <input type="submit"> </form> </body> </html>
When clicking on the submit button I'll get redirected to PayPal and can make the payment.
I can either send the form data with method="post" or method="get".
If I'm using my code with `method="post"` I'm getting redirected to a page looking like this:
When using exactly the same code but changing method="post" to method="get" I'm getting redirected to a page looking like this:
This doesn't really look beautiful. I prefer the first one and I think my customers will do so, too.
Does anybody know how I can fix that? Is there any PayPal value I can pass with my form to get the new layout?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Me482309 When testing your button without encrypting, it for example:
<form action="https://www.paypal.com/cgi-bin/webscr" method="GET">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="seller@email.com">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="charset" value="UTF-8">
<input type="hidden" name="amount" value="4.20">
<input type="hidden" name="lc" value="DE">
<input type="hidden" name="item_name" value="My Test product">
<input type="hidden" name="return" value="http://www.example.com/success.php">
<input type="hidden" name="cancel_url" value="http://www.example.com/error.php">
<input type="submit">
</form>
It's working fine, so I suspect our new checkout it's not handling properly the"encrypted" data via GET (it could be intended though) and that's why we are falling back.
Is there any reason why you would prefer using GET rather than POST? We would recommend the later.
Thanks.
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- SetExpressCheckout 10003 error with ITEMCATEGORY=Digital in NVP/SOAP APIs
- Issue with Empty store_info in Response Using /v1/reporting/transactions on Sandbox API in REST APIs
- recurring payments when price maybe changed and price have 2 decimal point in REST APIs
- How do I update shipping in the popup when using onShippingAddressChange() in REST APIs
- does api-m.sandbox.paypal.com or the real api endpoint support IPv6? in REST APIs