skip to Main Content

My checkout code

let ORDERPRICE = 2;
paypal.Buttons({
    createOrder: function(data, actions) {
        return actions.order.create({
            application_context: {
                shipping_preference: "NO_SHIPPING",
                brand_name: "MYCOMP",
                user_action: 'PAY_NOW',
                payment_method: {
                    payee_preferred: 'IMMEDIATE_PAYMENT_REQUIRED'
                }
            },
            payer: {
                name: {
                    given_name: 'NAME'
                },
                email_address: '[email protected]'
            },
            purchase_units: [{
                description: "description",
                amount: {
                    currency_code: 'EUR',
                    value: ORDERPRICE
                }
            }]
        });
    },
    onApprove: function(data, actions) {
      return actions.order.capture().then(function(details) {
          //submitting my form to show thank you page
        var sentform = document.getElementById('booking-sent');
        sentform.submit();
      });
    },
    style: {
                color:  'blue'
            }
  }).render('#paypal-button-container');

In a browser debug i see a POST to https://www.paypal.com/smart/api/order/23H57866L56525306/capture And i get an answer from PayPal

    {"ack":"contingency","contingency":"UNPROCESSABLE_ENTITY","data":
    {"name":"UNPROCESSABLE_ENTITY","details":[{"issue":"TRANSACTION_REFUSED","description":"The request was refused"}],
"message":"The requested action could not be performed, semantically incorrect, or failed business validation.","debug_id":"282422b19213c",
    "links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-TRANSACTION_REFUSED","rel":"information_link","method":"GET"}]},"meta":{"calc":"282422b19213c","rlog":"rZJvnqaaQhLn%2FnmWT8cSUueWscmrtUHe5Y1Bd%2FeqyvyOTq66rSXAcnM25I5c5rd3HxcyHxUk51TwoDOk%2By6wR%2Bw1HIUZ5ikN_17823c767ad"},"server":"OIZ58dNapHV5upm8ATCTYU49pCRnWLUsUjSypMRTXJSK5O3nEGxxJcKhByP9VmJq8cMcxl0h826w9SamyEn7niIWkJCJ_dYRHcQcnfMQSPWr2KIOUwJTg_fz4H6p100NKDfIiTBVCsopCu5fUadAqZMpyXvcJvyrj70N6Vvp9rMUXBfLj7d7HnDtxtM_0wO0JUB8gZUJzNmGTn6283Qwandfgn1LcTH6mnja87iXsKVRSFcuLVmSXDOWbhZ3Bh0Dk9hD5ihBeK4T9DYh5TCqe0"}

When I’m going to https://developer.paypal.com/docs/api/orders/v2/#error-TRANSACTION_REFUSED there’s no clue there what to do.

2

Answers


  1. Chosen as BEST ANSWER

    The reason was business account settings. Above code is totally ok.

    Setting you need to take care of is the currency. To be more specific, you need to point all currencies you (as a business account) accept. In this case, I have set up Euro (EUR) as a currency of the payment. Meanwhile business account by default has only US Dollar (USD) set up as accepted currency.


  2. The transaction was refused.

    Perhaps it was refused in part because you specified:

                payment_method: {
                    payee_preferred: 'IMMEDIATE_PAYMENT_REQUIRED'
                }
    

    And it was going to be ‘pending’ (not immediate), for any number of possible reasons.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search