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
- Seller "Buy now" button - unable to edit a button in PayPal Payments Standard
- Cart dropps items, fails to return customer to previous window in PayPal Payments Standard
- Hosted Buttons have changed. How can I now edit the item ID and stock? in PayPal Payments Standard
- [UNPROCESSABLE_ENTITY], but payment went through in PayPal Payments Standard
- When clicking on a payment button generates error: Unexpected token ... in PayPal Payments Standard