Skip to content
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

ConfirmSetupIntentParams should have a constructor that doesn't require a PaymentMethod #1730

Closed
frewsxcv opened this issue Oct 18, 2019 · 1 comment · Fixed by #1731
Closed
Assignees
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally

Comments

@frewsxcv
Copy link

Right now, to confirm a SetupIntent with the SDK, one needs to provide either the ID of the PaymentMethod, or raw payment method details. It's possible for a SetupIntent to be created with a PaymentMethod, so supplying it during confirmation should be optional. This would match the optional param behavior in the API.

Relevant code:

companion object {
/**
* Create the parameters necessary for confirming a SetupIntent while attaching a
* PaymentMethod that already exits.
*
* @param paymentMethodId the ID of the PaymentMethod that is being attached to the
* SetupIntent being confirmed
* @param clientSecret client secret from the SetupIntent being confirmed
* @param returnUrl the URL the customer should be redirected to after the authorization process
* @return params that can be use to confirm a SetupIntent
*/
@JvmStatic
@JvmOverloads
fun create(
paymentMethodId: String,
clientSecret: String,
returnUrl: String? = null
): ConfirmSetupIntentParams {
return Builder(clientSecret)
.setReturnUrl(returnUrl)
.setPaymentMethodId(paymentMethodId)
.build()
}
/**
* Create the parameters necessary for confirming a SetupIntent with a new PaymentMethod
*
* @param paymentMethodCreateParams the params to create a new PaymentMethod that will be
* attached to the SetupIntent being confirmed
* @param clientSecret client secret from the SetupIntent being confirmed
* @param returnUrl the URL the customer should be redirected to after the authorization
* process
* @return params that can be use to confirm a SetupIntent
*/
@JvmOverloads
@JvmStatic
fun create(
paymentMethodCreateParams: PaymentMethodCreateParams,
clientSecret: String,
returnUrl: String? = null
): ConfirmSetupIntentParams {
return Builder(clientSecret)
.setPaymentMethodCreateParams(paymentMethodCreateParams)
.setReturnUrl(returnUrl)
.build()
}
}

@mshafrir-stripe mshafrir-stripe added the triaged Issue has been reviewed by Stripe and is being tracked internally label Oct 21, 2019
@mshafrir-stripe mshafrir-stripe self-assigned this Oct 21, 2019
mshafrir-stripe added a commit that referenced this issue Oct 21, 2019
A method to create a `ConfirmSetupIntentParams` without
specifying a payment method to attach.

Fixes #1730
@mshafrir-stripe
Copy link
Collaborator

@frewsxcv thanks for filing!

mshafrir-stripe added a commit that referenced this issue Oct 21, 2019
A method to create a `ConfirmSetupIntentParams` without
specifying a payment method to attach.

Fixes #1730
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants