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

Shipping method dismissal prevents payment completion. #818

Closed
nikolaigeorgie opened this issue Oct 29, 2017 · 1 comment
Closed

Shipping method dismissal prevents payment completion. #818

nikolaigeorgie opened this issue Oct 29, 2017 · 1 comment
Assignees

Comments

@nikolaigeorgie
Copy link

nikolaigeorgie commented Oct 29, 2017

The only problem is that the payment cannot be completed after the successful dismissal (See the issue below). Every time I try to complete the purchase, I receive the shipping dialogue..

I previously opened an issue for this subject, although the solution produced an error that doesn't not allow the user to complete the checkout process.
#817

The following code will produce the problem:

` func paymentContext(_ paymentContext: STPPaymentContext, didUpdateShippingAddress address: STPAddress, completion: @escaping STPShippingMethodsCompletionBlock) {

guard let countryAddress = address.country else { return }
guard let postalCodeAddress = address.postalCode else { return }
guard let cityAddress = address.city else { return }
guard let nameAddress = address.name else { return }
guard let streetLineAddress = address.line1 else { return }
guard let apartmentLineAddress = address.line2 else { return }
guard let stateAddress = address.state else { return }
guard let phoneAddress = address.phone else { return }

shippingCountry = countryAddress
shippingZipCode = postalCodeAddress
shippingCity = cityAddress
shippingName = nameAddress
shippingStreetLine = streetLineAddress
shippingApartmentLine = apartmentLineAddress
shippingState = stateAddress
shippingPhone = phoneAddress
completion(.valid, nil, nil, nil)

}`

@bg-stripe
Copy link
Contributor

Ah, you're totally right, sorry about that! I was mistaken about my suggestion. You should instead not implement the paymentContext:didUpdateShippingAddress method (which is optional, and should only be used if you need to collect a shipping method – I'll make sure this is documented better).

To get the shipping information entered by the user from PaymentContext, you should instead use the STPPaymentContext instance's shippingAddress property after the payment completes, e.g. in paymentContext:didCreatePaymentResult:, where you could send the shipping information to your backend along with other information about the order.

@bg-stripe bg-stripe self-assigned this Oct 30, 2017
mludowise-stripe added a commit that referenced this issue Mar 2, 2022
Updates DocumentCaptureView to use an ErrorView for its error state instead of a placeholder label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants