woocommerce/woocommerce-gateway-stripe

Confirm we're passing the expected request body for co-branded cards

Closed this issue · 1 comments

This issue aims to confirm whether our requests for co-branded cards contain the correct information.

Right now, looks like we're only using the preferred network to store it under the _stripe_card_brand order meta, but I didn't find any other use of this information.

I temporarily removed the request parameters passed when updating a payment intent in this other PR because it was failing, but it'd be good to double-check what the correct parameters are.

Questions

  1. Should we pass any information about the co-branded card to our requests for creating and updating payment intents?
  2. If so, where are we doing it?

Some background

  • In the docs, they mention passing the preferred network when creating the PaymentMethod, the PaymentIntent, and the SetupIntent. Reference
  • I see we're passing the following information to the request when updating a payment intent, but I don't see us passing this when creating it.
  • Still, updating a payment intent with a co-branded card fails. See the replication steps below.

Replication steps - Reusing a payment intent with co-branded cards failure

  1. Check out trunk or the 3.8.1 tag
  2. As a shopper, add a product to the cart and proceed to checkout
  3. Enter the details of a failing card, like 4000 0000 0000 0002
  4. Place the order
  5. Try again using the details of a co-branded card, like 4000 0025 0000 1001
  6. On the dropdown at the right of the field, select "Cartes bancaires"
  7. Notice that the payment processing fails with a 400 error code and the following information
parameter_unknown - payment_method_options[card][brand]
Received unknown parameter: payment_method_options[card][brand]
Request body
{
  "capture_method": "automatic",
  "payment_method": "pm_1PM51MDhoeKpknCIpl4x6gwH",
  "mandate_data": {
    "customer_acceptance": {
      "type": "online",
      "online": {
        "user_agent": "WooCommerce Stripe Gateway8.3.0; http://localhost:8082",
        "ip_address": "xxx"
      }
    }
  },
  "payment_method_options": {
    "card": {
      "brand": "cartes_bancaires"
    }
  },
  "shipping": {
    "address": {
      "country": "US",
      "line1": "Street 123",
      "state": "CA",
      "postal_code": "94110",
      "city": "Lecity",
      "line2": ""
    },
    "name": "Francis TheFrench"
  }
}

Hey @wjrosa ! Assigning this one to you because you're probably more familiar with the co-branded functionality. Hope that's okay.