cancel
Showing results for 
Search instead for 
Did you mean: 

PayPal JavaScript SDK Image and Item Name

Member

PayPal JavaScript SDK Image and Item Name

Hello,

 

I'm currently integrating PayPal JavaScript SDK.

I would like to show item name and it's image on the payment confirmation page (The one with 'Pay Now' button).

I've checked through documentation, but could not find any options for this type of parameters.

 

Also I'm having the trouble with setting goods type to DIGITALGOODS. As soon as I'm trying to put it in accordance with https://developer.paypal.com/docs/api/orders/v2/ it creates more and more 'required' params, so I'm getting Error 400. Does anyone have a good example of digitals goods parameters configuration?

 

My current button configuration looks like this;

<script>
paypal.Buttons({
style: {
'color': 'gold', // gold, blue, silver
'shape': 'rect', // rect, pill
'label': 'pay' // paypal, checkout, pay
},
createOrder: function(data, actions) {
// Set up the transaction
return actions.order.create({
purchase_units: [{
amount: {
value: '1.99',
currency: 'USD'
},
custom_id: 'f12b98e0-83b8-41c8-9321-1797618f07c4',
}],
});
},
onApprove: function(data, actions) {
// alert('onApprove');
// Capture the funds from the transaction
return actions.order.capture().then(function(details) {
// Show a success message to your buyer
// alert('Transaction completed by ' + details.payer.name.given_name);
return fetch('/api/purchases/f12b98e0-83b8-41c8-9321-1797618f07c4', {
method: 'post',
body: JSON.stringify({
orderID: data.orderID
})
});
});
},
onCancel: function(data, actiond) {
// alert('onCancel');
},
onError: function(data, actions) {
// alert('onError');
}, onClick: function(){
// alert('clicked');
}
}).render('#paypal-button-container');
</script>