question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Paypal fails with Invalid Action v65 // 3.18.2

See original GitHub issue

Describe the bug I’m trying to use the drop in solution to handle the paypal flow. This fails with an Error: Invalid Action.

invalid_action

To Reproduce Steps to reproduce the behavior:

The paymentMethod is taken from the onSumit call within a checkout.create('dropin')

1. Payment request

curl https: //checkout-test.adyen.com/v65/payments \
-H "x-API-key: XXXX" \
-H "content-type: application/json" \
-d '{
    "additionalData": {
        "allow3DS2": true
    },
    "amount": {
        "currency": "EUR",
        "value": 12400
    },
    "billingAddress": {
        "city": "Berlin",
        "country": "DE",
        "houseNumberOrName": "63",
        "postalCode": "10117",
        "street": "Friedrichstrasse"
    },
    "channel": "Web",
    "countryCode": "DE",
    "deliveryAddress": {
        "city": "Berlin",
        "country": "DE",
        "houseNumberOrName": "63",
        "postalCode": "10117",
        "street": "Friedrichstrasse"
    },
    "lineItems": [
        {
            "amountIncludingTax": 11900,
            "description": "An Elephant",
            "id": "some-id",
            "quantity": 1,
            "taxCategory": "high"
        }
    ],
    "merchantAccount": "MyMerchantAccount",
    "origin": "http://localhost:3030",
    "paymentMethod": {
        "subtype": "sdk",
        "type": "paypal"
    },
    "reference": "my-order-id",
    "returnUrl": "http://localhost:3030/checkout/return?oid=my-order-id",
    "shopperEmail": "my@email.com",
    "shopperIP": "::1",
    "telephoneNumber": "0000"
}'

2. Returns CartOrderResponse

  {
    "resultCode": "Pending",
    "action": {        
        "paymentData": "Ab0...",
        "paymentMethodType": "paypal",
        "sdkData": {
            "token": "EC-3.."
        },
        "type": "sdk"
    },
    "details": [
        {
            "key": "token",
            "type": "text"
        }
    ],
    "outputDetails": {
        "token": "EC-3.."
    },
    "paymentData": "Ab0...",
}

3. Render within React

    const setupAdyenPayment = async (orderResponse: CartOrderResponse) => {
        try {
            // eslint-disable-next-line
            // @ts-ignore
            await import('@adyen/adyen-web/dist/adyen.css');

            const AdyenCheckout = await import('@adyen/adyen-web');
            const configuration = {
                locale: config.adyenLocale,
                environment: config.adyenEnv,
                clientKey: config.adyenClientKey,
                translations,
                onAdditionalDetails: async (state: any) => {
                    try {
                        await onSubmitChallenge(state.data);
                    } catch (err) {
                        console.log(err);
                    }
                }
            };
            if (containerRef.current) {
                const checkout = new AdyenCheckout.default(configuration);
                checkout.createFromAction(orderResponse.action).mount(containerRef.current);                
            }
        } catch (err) {
            console.log(err);
        }
    };

Expected behavior Should not throw an error but handle paypal

Desktop (please complete the following information):

  • OS: osx
  • Browser ff
  • Version: latest

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pabloaicommented, Dec 7, 2020

Hi @steffenmllr, and thanks for reaching out.

For the PayPal Component, you have to use the component.handleAction method instead of using the checkout.createFromAction method.

The reason for this is that the component will create a promise which will be resolved when the action is sent back to it. In other words, once the PayPal button is clicked, it will wait for the data inside the action object sent in the /payments endpoint response to show the pop-up.

I hope this helps, let us know if there’s any other questions.

0reactions
ribeiroguilhermecommented, Dec 10, 2021

Closing this issue as it seems stale. If you still have problems integrating PayPal, I am happy to reopen it and help you out with that!

Read more comments on GitHub >

github_iconTop Results From Across the Web

PayPal error messages when trying to transfer money
Here are a few reasons why you may have issues transferring money to your bank.
Read more >
Orders v2 errors - PayPal Developer
INVALID_ACCOUNT_STATUS : Account validations failed for the user. The request is not well-formed, is syntactically incorrect, or violates ...
Read more >
Transaction Responses - PayPal Developer
This error can result in an uncaptured authorization if the transaction is an authorization or a sale, except on the following processors: - ......
Read more >
API responses - PayPal Developer
For failed requests, PayPal returns HTTP 4XX status codes if something passed in the request has an error or 5XX status codes when...
Read more >
HTML Form Basics for PayPal Payments Standard
The FORM tag includes two required attributes, action and method , which ... No address is shown if the address is invalid, such...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found