paypal advanced checkout doesn't load form elements
aliraza51
New Community Member
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Mar-03-2022
03:21 AM
I want to integrate paypal advanced checkout to my website, but I have problems with loading the custom form elements
this is my form page:
<script src="https://www.paypal.com/sdk/js?components=buttons,hosted-fields&client-id={{env('PAYPAL_CLIENT_ID')}}" data-client-token="{{$client_token}}" ></script> let orderId; // Displays PayPal buttons paypal.Buttons({ style: { layout: 'horizontal' }, createOrder: function(data, actions) { return actions.order.create({ purchase_units: [{ amount: { value: "1.00" } }] }); }, onApprove: function(data, actions) { return actions.order.capture().then(function(details) { window.location.href = '/success.html'; }); } }).render("#paypal-button-container"); // If this returns false or the card fields aren't visible, see Step #1. if (paypal.HostedFields.isEligible()) { // Renders card fields paypal.HostedFields.render({ // Call your server to set up the transaction createOrder: function () { return fetch('/paypal/process/', { method: 'post' }).then(function(res) { return res.json(); }).then(function(orderData) { orderId = orderData.id; return orderId; }); }, .......... } else { // Hides card fields if the merchant isn't eligible document.querySelector("#card-form").style = 'display: none'; }
enter where it says (// Hides card fields if the merchant isn't eligible) I have the business account enabled and I previously generated the client token correctly
Labels:
- Labels:
-
Payouts Rest APIs
1 REPLY 1
zudian
New Community Member
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun-12-2022
07:54 PM
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Need help to integrate Advanced Checkout (PPCP) With WHMCS in PayPal Upgrade Community
- PayPal Checkout golden buttons opens checkout window with different options in PayPal Upgrade Community
- Need help to integrate PayPal Checkout Advanced (PPCP) with WooCommerce in PayPal Upgrade Community
- The Advanced Credit Card Option from PayPal Advanced Checkout SDK is displaying different UIs. in PayPal Upgrade Community
- Authorization being forced prior to Paypal Button becoming available. in PayPal Payments Standard