I have implemented PayPal rest integration, and now I can create payments. So I have to enable payments approval now. I used this documentation:
https://developer.paypal.com/docs/integration/web/accept-paypal-payment/
As I can see, usage of approval_url
i a legacy method (it opens approval page in a separate tab). But a modern one, described here:
https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/advanced-integration/#set-up-your-client
does require to render PayPal button using checkout.js
library script. I want to use my own button, but don't know what to call to perform payment approval. And I don's know if it is allowed at all. Can not find the good answer anywhere. Please help.
PayPal button The default value is gold , but you can also set it to: black , blue , silver , or white . Overrides the shape of the button. The default value is softEdges , but you can also set it to hardEdges or rounded . Adds a label next to the button logo.
PayPal Express is very similar to PayPal Standard with one major difference: the checkout flow. PayPal Express avoids the IPN issues that arise with PayPal Standard. Customers will be directed to PayPal from your site, but they don't complete checkout at PayPal.
PayPal has deprecated PayPal Express payment. Existing forms with PayPal Express will still work, but we highly recommend switching to/using our newest PayPal integrations, such as the following: Paypal Checkout.
No, not easily it isn't The customization link provided above is a poor imitation of customization. Customization to most dev's is likely to mean the ability to choose any button you want and to interact using the API programmatically. The poor API provided by paypal currently only allows choosing the color/size of their buttons. It also forces you to use their checkout.js on load so that they can track your users. I would avoid it if possible.
Basically your choices now are:
Use express checkout with the checkout.js they provide and submit to paypals tracking/limited customization. In paypal marketing speak, engage in the optimized loading button with fully cohesive paypal branding.
Use basic checkout, that requires a redirect back and forth. Old school tech still working.
Try to workaround the limited checkout.js and find the secret API behind it to create your customized button.
I went for option 2.
I've discovered I was able to get this working...
I'm using https://www.paypalobjects.com/api/checkout.js
then setting up my form like so:
paypal.checkout.setup('{{ $paypalMerchantID }}', {
environment: '{{ $paypalEnvironment }}',
container: 'paypal-payment-form',
buttons: [{
container: 'paypal-payment-form',
type: 'checkout',
color: 'gold',
size: 'responsive',
shape: 'pill'
}]
});
This will create the button in the container...but you can also have a button exist in the container before hand like so:
<button data-paypal-button="true">Pay via Paypal</button>
After some testing, the only property you need is data-paypal-button="true"
.
Proceed to hide the ugly button:
.paypal-button-widget { display: none; }
Hacky yes but why is it so hard to use your own button Paypal :^)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With