-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support stripe connect #83
base: main
Are you sure you want to change the base?
Conversation
Optional string. Gets passed to Stripe constructor, either window or via stripe-js. Both accept a StripeConstructorOptions parameter after publishableKey.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good can you add some tests?
I would love to get this integrated (so I do not have to copy paste all your lovely code). My problem is that I am not competent enough to write the tests you ask for above without some hints of what you would need to be satisfied. Please advise so this can be integrated :) |
@whiteancient take a look at the tests in this block: stripe-elements/test/stripe-elements.test.ts Line 277 in 1a4033c
generate="payment-method" eventually gets a payment method objectstripe-elements/test/stripe-elements.test.ts Lines 805 to 812 in 1a4033c
You'll need to add the relevant methods to this mocked stripe.js object: https://github.com/bennypowers/stripe-elements/blob/1a4033cdfe5669a6e50cadd030847912bd0e8c5b/test/mock-stripe/index.ts stripe-elements/test/test-helpers.ts Lines 504 to 508 in 1a4033c
|
Is this still relevant? |
The motivation behind this PR is to allow support for direct charges against connected accounts. To do this, we must pass in the stripeAccount attribute to the StripeConstructorOptions parameter when initialising stripe-js.
This PR adds an additional, optional attribute
stripe-account
, allowing the user to provide the ID of the connected account they wish to make charges against.This is supported both when initialising either via window.Stripe or loadStripe, both methods accept a StripeConstructorOptions parameter after publishableKey. This is where we set the stripe-account attribute that is passed to the web component.
See example of loading stripe elements with stripeAccount attribute:
https://stripe.com/docs/connect/creating-a-payments-page?platform=web&ui=elements#set-up-stripe-elements
When this value is set, the stripe library sets the
stripe-account
header on corresponding requests. It only needs to be set when we initialise stripe js, the rest is handled by stripe's library.