woocommerce / woocommerce-gateway-stripe

The official Stripe Payment Gateway for WooCommerce
https://wordpress.org/plugins/woocommerce-gateway-stripe/
229 stars 200 forks source link

[4.0] Associate single use source charge with customer if logged in #326

Closed thorsten-stripe closed 7 years ago

thorsten-stripe commented 7 years ago

[Nice to have] A single use source can be associated with a customer object at the time of charging without adding it to the customer's list of sources: https://stripe.com/docs/sources/customers#single-use-sources

This allows for the charge to be referenced with the customer in the Stripe Dashboard

thorsten-stripe commented 7 years ago

@roykho maybe even go as far as creating a customer object in Stripe (if not guest checkout) even if a single_use method was selected. That way the payment would be associated with a customer object in the Stripe Dashboard. Wdyt?

roykho commented 7 years ago

@thorsten-stripe yeah we could do that.

thorsten-stripe commented 7 years ago

Not working for me, this is the request body that's coming through:

{
  "currency": "eur",
  "amount": "5000",
  "description": "WooTest - Order 36",
  "expand": [
    "balance_transaction"
  ],
  "metadata": {
    "customer_name": "Testr Test",
    "customer_email": "thorsten_123@gmail.com",
    "order_id": "36"
  },
  "source": "src_1AnFUWCKYVa4gpq6Zohr7zEr"
}

and I'm up to date with commit https://github.com/woocommerce/woocommerce-gateway-stripe/commit/264353d638265ccd40b9dc6416e3005f1fecc283

roykho commented 7 years ago

They have to either already have an account with stripe customer id in the meta or opted to save account and/or if new customer, have opted to "create account"

thorsten-stripe commented 7 years ago

Yes the stripe customer object gets created and is also referenced in the wp_usermeta table, but it not submitted in the charge request for the single_use source.

Maybe because the charge request happens after the redirect?

roykho commented 7 years ago

Perhaps its 3d secure thats why. Try this CC # 378282246310005

thorsten-stripe commented 7 years ago

378282246310005 is an Amex test card and therefore reusable. I'm trying with Bancontact

roykho commented 7 years ago

This is working but just not for redirect payments

roykho commented 7 years ago

Redirect payment works as well now. Please try latest 4.0.0 branch.

thorsten-stripe commented 7 years ago

Yes, works like a charm, thank you :)