How do I handle INSTRUMENT_DECLINED error?

MTS_PaulKiran
Moderator
Moderator

Cause:

This error occurs when your payer's funding source was declined either by the processor or bank, or the instrument cannot be used for this transaction. This error typically occurs while capturing the payment.
Here are some common reasons why a payment is being declined:

  • The billing address associated with the payment method is incorrect.
  • The transaction exceeds the card limit.
  • The card issuer denied the transaction.

Sample API Error Response:

 

{ 
    "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." 
        } 
    ], 
    ... 
}

 

Solution:

Restarting the payment is required if you directly call the Orders API from your server. If you use actions.order.capture(), the script automatically restarts the checkout flow and prompts the payer to select a different funding source.
Restart the payment in the onApprove function as follows:

 

Paypal.Buttons({ 
  onApprove: function (data, actions) { 
    return fetch('/my-server/capture-paypal-transaction', { 
      headers: { 
        'content-type': 'application/json' 
      }, 
      body: JSON.stringify({ 
        orderID: data.orderID 
      }) 
    }).then(function(res) { 
      return res.json(); 
    }).then(function(captureData) { 
      if (captureData.error === 'INSTRUMENT_DECLINED'); // Your server response structure and key names are what you choose 
        return actions.restart(); 
      } 
    }); 
  } 
}).render('#paypal-button-container'); 

 

For more information, please refer to the Handle funding failures documentation available here.

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.