Paypal Button not Showing
3Mman
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Jan-04-2023
02:54 PM
Hello PayPal Community,
I tried to update our PayPal payment button to the latest version, I pasted the following code to my webpage, but the PayPal payment button does not show up at all when I launch the page. Are there any errors in my code? Please help, thank you very much for your time and effort.
>>>>>>>>>>>>>>>>>>>>>>>>>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1"> </head>
<body>
<script src="https://www.paypal.com/sdk/js?client-id=MY-ID¤cy=USD"></script> <!-- Set up a container element for the button --> <div id="paypal-button-container"></div> <script> paypal.Buttons({ // Sets up the transaction when a payment button is clicked createOrder: (data, actions) => { return actions.order.create({ purchase_units: [{ amount: { value: '121.88' // Can also reference a variable or function } description: { value: 'Online Transaction (g_1-2097_1-2327)' } invoice_id: { value: 'Online Order ID' } payee: { email: { value: 'Customer's email address' } } }] }); }, // Finalize the transaction after payer approval onApprove: (data, actions) => { return actions.order.capture().then(function(orderData) { // Successful capture! For dev/demo purposes: console.log('Capture result', orderData, JSON.stringify(orderData, null, 2)); const transaction = orderData.purchase_units[0].payments.captures[0]; alert(`Transaction ${transaction.status}: ${transaction.id}\n\nSee console for all available details`); // When ready to go live, remove the alert and show a success message within this page. For example: // const element = document.getElementById('paypal-button-container'); actions.redirect('https://www.test.com/AcceptPayment'); }); } }).render('#paypal-button-container'); </script>
</body
0 REPLIES 0
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
- This organization can't accept donations right now. in PayPal Payments Standard
- Paypal transaction description not showing from Modern Events Calendar connection in PayPal Payments Standard
- Customers can not subscribe to my paypal plan. in PayPal Payments Standard
- How to avoid showing PayPal installment payment messages on product pages for ineligible users? in SDKs
- When login with sandbox account, I get the error: something went wrong. in Sandbox Environment