Adyen / adyen-magento2

Adyen Payment plugin for Magento2
MIT License
155 stars 210 forks source link

[ECP-8797] [BUG] ApplePay is not returned in Alternative Payment methods via /payment-information without first adding a product to the cart #2363

Open ryan-lambert-IEX opened 9 months ago

ryan-lambert-IEX commented 9 months ago

Describe the bug Per the Headless Docs, the /payment-information endpoint is used to retrieve the /paymentMethods from Adyen. If you do not first add an item to the cart, ApplePay is missing. Looking at the Adyen API Logs, this appears to be because no amount field is passed until an item exists in the cart.

// example request without item in cart in API logs
{
   "channel" : "Web",
   "merchantAccount" : "XXXX",
   "countryCode" : "US",
   "shopperLocale" : "en_US",
   "amount" : {
      "currency" : "USD"
   }
}
// example request with item in cart in API logs
{
   "channel" : "Web",
   "merchantAccount" : "XXXX",
   "countryCode" : "US",
   "shopperLocale" : "en_US",
   "amount" : {
      "currency" : "USD",
      "value" : 5200
   }
}

To Reproduce curl -X POST https://dev.nexusbox-server.dev/rest/default/V1/guest-carts curl -X POST https:/dev.nexusbox-server.dev/rest/default/V1/guest-carts/D87vy9KEMQbup2KfhScV6VZwkUH4sGt3/payment-information

[
    {
        "code": "adyen_cc",
        "title": "Adyen Credit Card"
    },
    {
        "code": "adyen_googlepay",
        "title": "Google Pay"
    },
    {
        "code": "adyen_cc_vault",
        "title": "Stored Cards (Adyen)"
    },
    {
        "code": "adyen_googlepay_vault",
        "title": "Stored GooglePay"
    },
    {
        "code": "free",
        "title": "No Payment Information Required"
    }
]

When I add an item to the cart and retry

[
    {
        "code": "adyen_cc",
        "title": "Adyen Credit Card"
    },
    {
        "code": "adyen_applepay",
        "title": "Apple Pay"
    },
    {
        "code": "adyen_googlepay",
        "title": "Google Pay"
    },
    {
        "code": "adyen_cc_vault",
        "title": "Stored Cards (Adyen)"
    },
    {
        "code": "adyen_googlepay_vault",
        "title": "Stored GooglePay"
    },
    {
        "code": "adyen_applepay_vault",
        "title": "Apple Pay"
    }
]

Expected behavior Our Headless flow shows ApplePay availability to users up front; my expectation is that a default amount: 0 should be passed from payment-information so we can see all payment methods without having to first add an item.

Magento version Adobe Commerce ver. 2.4.6-p3

Plugin version 9.0.2

Additional context We are building a headless flow. Our business: dispatch.co

hossam-adyen commented 9 months ago

Hi @ryan-lambert-IEX, thanks for reporting this bug, we will keep you posted once it got solved