How do I edit a Buy Now, Smart Button that was created in November of 2022?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does anyone know how to edit a Buy Now, Smart Button that was created in November of 2022? It still works but I can't even find it anymore in my PayPal Business Account because everything has changed. Even the online tutorials that I can find about creating a Smart Button are out of date now.
No, it's not in 'My Saved Buttons'.
This is the code with my Client ID and other information changed:
<div id="smart-button-container">
<div>
<div style="margin-bottom: 1.25rem;">
<p class="nvl-p1">Select Your Purchase Option</p>
<select id="item-options">
<option value="Testing Option 01" price="9.99">Testing Option 01</option>
<option value="Testing Option 02" price="10.99">Testing Option 02</option>
<option value="Testing Option 03" price="11.99">Testing Option 03</option>
</select>
<select style="visibility: hidden" id="quantitySelect"></select>
<p class="nvl-p2">Pay Using Whichever Method Suits You Best</p>
</div>
<div id="paypal-button-container"></div>
</div>
</div>
<script src="https://www.paypal.com/sdk/js?client-id=XXXXXXgqspgMNxW5YyfUG2A4Os8PSUS5NTS50fxxxU_dvJB_NU-Eh_GOfOR_..." data-sdk-integration-source="button-factory"></script>
<script>
function initPayPalButton() {
var shipping = 3.65;
var itemOptions = document.querySelector("#smart-button-container #item-options");
var quantity = parseInt();
var quantitySelect = document.querySelector("#smart-button-container #quantitySelect");
if (!isNaN(quantity)) {
quantitySelect.style.visibility = "visible";
}
var orderDescription = 'Select Your Purchase Option';
if (orderDescription === '') {
orderDescription = 'Item';
}
paypal.Buttons({
style: {
shape: 'rect',
color: 'gold',
layout: 'vertical',
label: 'buynow',
},
createOrder: function(data, actions) {
var selectedItemDescription = itemOptions.options[itemOptions.selectedIndex].value;
var selectedItemPrice = parseFloat(itemOptions.options[itemOptions.selectedIndex].getAttribute("price"));
var tax = (0 === 0 || false) ? 0 : (selectedItemPrice * (parseFloat(0) / 100));
if (quantitySelect.options.length > 0) {
quantity = parseInt(quantitySelect.options[quantitySelect.selectedIndex].value);
} else {
quantity = 1;
}
tax *= quantity;
tax = Math.round(tax * 100) / 100;
var priceTotal = quantity * selectedItemPrice + parseFloat(shipping) + tax;
priceTotal = Math.round(priceTotal * 100) / 100;
var itemTotalValue = Math.round((selectedItemPrice * quantity) * 100) / 100;
return actions.order.create({
purchase_units: [{
description: orderDescription,
amount: {
currency_code: 'USD',
value: priceTotal,
breakdown: {
item_total: {
currency_code: 'USD',
value: itemTotalValue,
},
shipping: {
currency_code: 'USD',
value: shipping,
},
tax_total: {
currency_code: 'USD',
value: tax,
}
}
},
items: [{
name: selectedItemDescription,
unit_amount: {
currency_code: 'USD',
value: selectedItemPrice,
},
quantity: quantity
}]
}]
});
},
onApprove: function(data, actions) {
// This function captures the funds from the transaction.
return actions.order.capture().then(function(details) {
// This function shows a transaction success message to your buyer.
actions.redirect(document.location.href = "https://sunshinevm.com/purchase-made_nvl.html");
});
},
onError: function(err) {
console.log(err);
},
}).render('#paypal-button-container');
}
initPayPalButton();
</script>
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Buttons and Links Error in PayPal Upgrade Community
- Customers can not subscribe to my paypal plan. in PayPal Payments Standard
- Could not create PayPal Buttons in PayPal Payments Standard
- I haven't the button to create a new sandbox account on my developer Paypal account in Sandbox Environment
- Shipping Calculations in PayPal Payments Standard