Order could not be captured

printphoto44
Contributor
Contributor

I've got a sandbox account that was working OK, after some transaction got success that's give me issue like Order could not be captured and I am now consistently getting the above error. 

I'm using paypay.Buttons:-

<script src="https://www.paypal.com/sdk/js?client-id=sb"></script>
paypal.Buttons({
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '0.01'
}
}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
alert('Transaction completed by ' + details.payer.name.given_name);
// Call your server to save the transaction
/*return fetch('/paypal-transaction-complete', {
method: 'post',
headers: {
'content-type': 'application/json'
},
body: JSON.stringify({
orderID: data.orderID
})
});*/
});
}
}).render('#paypal-button-container');

 

so please assists me to fix my issue.

Hope you understood the issue.

 

Thank You

P.H.Panchal

Login to Me Too
3 REPLIES 3

gbc-it
Contributor
Contributor

Put a reference ID in order:

createOrder: function(data, actions) {
  return actions.order.create({
      purchase_units: [{
      reference_id: "YOURID",
      amount: {
       value: '0.01'
      }
    }]
  })
},

Login to Me Too

shane43
New Community Member

the "YOURID" is this your API client ID or what?

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.