Paypal Integration Error

Sweetlifepartne
Contributor
Contributor

Hello team,

 

I have used custom paypal smart button script in my website for payment.

 

Below is the script which i used in  my code (using HTML & Javascript)

 

<script src="https:www.paypal.com/sdk/js?client-id=AQW2EB1gdF4t2kQIuJfTirEDneMyxJkDEDTPfIs7YM3BPNuNEjVnIsANPv0vKmczSOH8..." data-sdk-integration-source="button-factory"></script>
<script>
paypal.Buttons({
style: {
shape: 'rect',
color: 'gold',
layout: 'horizontal',
label: 'paypal',
tagline: false
},
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [
{
reference_id: "PUHF",
description: "Some description",
custom_id: "Something7364",
soft_descriptor: "Great description 1",
amount: {
currency_code: "AUD",
value: '0.50',
breakdown: {
item_total: {
currency_code: "AUD",
value: '0.50'
}
}
},
items: [
{
name: "Item 1",
description: "The best item ever",
sku: "xyz-2654",
unit_amount: {
currency_code: "AUD",
value: '0.50'
},
quantity: "1"
}

],

}
]
});
},

onApprove: function(data, actions) {
return actions.order.capture().then(function(data) {
window.location.href = "https:sweetlifepartner.com/index.php/paypal/callback?plan_id=2&amount=0.50&paymentID="+data.paymentID+"&payerID="+data.payerID+"&token="+data.paymentToken+"&pid=";
});
}
}).render('#paypal-button-container');
</script>

 

 

Using this script i am able to see button on my website but when customer ,login from their account it will not allow them to pay and give below error

 

{"ack":"contingency","contingency":"UNPROCESSABLE_ENTITY","data":{"name":"UNPROCESSABLE_ENTITY","details":[{"issue":"INSTRUMENT_DECLINED","description":"The instrument presented was either declined by the processor or bank, or it can't be used for this payment."}],"message":"The requested action could not be performed, semantically incorrect, or failed business validation.","debug_id":"4b006abc64a4a","links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-INSTRUMENT_DECLINED","rel":"information_link"..."}

 

 

I checked using by capture/authorize both method but its not working. Please help me resolve it and let me know if i missed any step.

 

 

Thanks in advanced.

 

Login to Me Too
1 REPLY 1

MTS_Chiranjeevi
Moderator
Moderator

Hi @Sweetlifepartne,

 

Thank you for contacting PayPal community.

 

We apologize for any inconvenience.

 

Upon checking the error details, we could see that the reported payment attempts failed to capture due to "INSTRUMENT_DECLINED" . 

Error description :

"description": "The instrument presented was either declined by the processor or bank, or it can't be used for this payment.",
"issue": "INSTRUMENT_DECLINED"
"message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
"name": "UNPROCESSABLE_ENTITY"

Guide link to resolve the issue: https://developer.paypal.com/docs/api/orders/v2/#error-INSTRUMENT_DECLINED

I request to please contact the user/customers to process payments via valid funding source.

 

Unfortunately, we are restricted to process live payments on merchants website. Can you please try to process a test payment via card which is not linked to your PayPal account.

Thank you so much for your patience and understanding.

 

Sincerely,

Chiranjeevi

PayPal, Inc.

 

If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution

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.