I'm having issues with the PayPal smart buttons interface. The documentation is very counterproductive.
The email samples in sandbox won't show the item descriptions/details. It just shows the totals. In one document on their site, the items
block is inside the purchase_units
block. That fails will no real error messages.
paypal.Buttons({
createOrder: function (data, actions) {
// Busy indicator.
var spinner = document.getElementById("spinner");
var cart = document.getElementById("vysshopcart");
spinner.style.display = "block";
cart.style.display = "none";
// This function sets up the details of the transaction, including the amount and line item details.
return actions.order.create({
purchase_units: [{
amount: {
value: "10",
"currency-code": "USD",
details: {
subtotal: "10",
shipping: "0",
tax: "0.00"
},
total: "10"
}
}],
links: [{
href: "http://192.168.249.20:81/virtual-yard-sale?invoice=2020092011397C1E",
rel: "approve"
}],
"items": [
{
"sku": "2",
"name": "Harry & David Snack Disk",
"price": "5.00",
"quantity": "1",
"category": "PHYSICAL_GOODS",
"currency": "USD"
}
, {
"sku": "10",
"name": "Raya Insulated Lunch Tote",
"price": "5.00",
"quantity": "1",
"category": "PHYSICAL_GOODS",
"currency": "USD"
}
]
});
},
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.
window.location.replace("http://192.168.249.20:81/virtual-yard-sale?invoice=2020092011397C1E");
});
}
}).render('#paypal-button-container');