POST/V2/checkout/orders failed transaction

SteveStuartDJ
Contributor
Contributor

Sales have been so infrequent, I went to my developer>API calls and saw lots of lines like this:

 

Date and time              HTTP status   Debug ID             Request path

14 Ma[Removed. Phone #s not permitted]/td>201 OKf2432637be34aPOST /v2/checkout/orders

(all with different dates)


I'm not that clued up on java, php etc., but I found there were others in the community with the same problem, all giving various answers & fixes.
My developer says 'it's one for Paypal' and sneaked off.
But I'm missing a line - an important line - in my code.
I'd  be eternally grateful if someone could glance through my code below and indicate what's missing?

The code was generated by the standard payments, so it should be OK?
The only thing I've added is the NO_SHIPPING as I sell digital goods, all downloaded, so I don't need the buyers' address.

Thanks in anticipation, Steve

PS: I can copy the .listener & the PaypalIPN if it's needed.

 

<div id="smart-button-container">
<div style="text-align: center;">
<div id="paypal-button-container"></div>
</div>
</div>
<script src="https://www.paypal.com/sdk/js?client-id=AR4axxxxxxxzYfdNSc7BZmrgI-75_OVs-Vl&enable-funding=venmo&cur..." data-sdk-integration-source="button-factory"></script>
<script>
function initPayPalButton() {
paypal.Buttons({
style: {
shape: 'pill',
color: 'gold',
layout: 'vertical',
label: 'buynow',

},

createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{"description":"Download 12 xxxxx4rch.htm","amount":{"currency_code":"GBP","value":3}}],

application_context: {
shipping_preference: 'NO_SHIPPING'
}

});
},

onApprove: function(data, actions) {
return actions.order.capture().then(function(orderData) {

// Full available details
console.log('Capture result', orderData, JSON.stringify(orderData, null, 2));

// Show a success message within this page, e.g.
const element = document.getElementById('paypal-button-container');
element.innerHTML = '';
element.innerHTML = '<h3>Thank you for your payment!</h3>';

//actions.redirect('https://www.website.com/index.html');

});
},

onError: function(err) {
console.log(err);
}
}).render('#paypal-button-container');
}
initPayPalButton();
</script>

Login to Me Too
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.