Skip to content

Instantly share code, notes, and snippets.

@armedoctopus
Last active April 4, 2019 17:35
PayPal Smart Payments Buttons customizations
paypal.Buttons({
locale: 'en_US',
style: {
layout: 'horizontal',
color: 'gold',
label: 'checkout',
shape: 'pill',
size: 'responsive',
tagline: false
},
createOrder: function(data, actions) {
return actions.order.create({
intent: 'CAPTURE',
purchase_units: [{
reference_id: AmplifyStore.state.user.attributes.sub, //256 characters
description: 'Songxy Audio Mastering', //this shows up in checkout description 127 characters
custom_id: AmplifyStore.state.federatedCredentials.identityId, //127 characters
soft_descriptor: 'SONGXY', //descriptor on the customer's credit card statement 22 characters
"items": [{
name: "Track 1",
description: "Mastering",
quantity: "5",
unit_amount: {
value: '5.00',
currency_code: 'USD',
},
tax: {
value: '5.00',
currency_code: 'USD',
},
sku: "AUD101", //127 characters
category: 'DIGITAL_GOODS',
},
{
name: "Track 2",
description: "Mastering",
quantity: "5",
unit_amount: {
value: '5.00',
currency_code: 'USD',
},
tax: {
value: '5.00',
currency_code: 'USD',
},
sku: "AUD101", //127 characters
category: 'DIGITAL_GOODS',
}
],
amount: {
value: '100.00',
currency_code: 'USD',
breakdown: {
tax_total: {
value: '50.00',
currency_code: 'USD',
},
item_total: {
value: '50.00',
currency_code: 'USD',
}
}
}
}]
})
}
}).render('#paypal-button-container')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment