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

Multiple requests to checkoutURL #141

Open
ainoske opened this issue Oct 18, 2024 · 1 comment
Open

Multiple requests to checkoutURL #141

ainoske opened this issue Oct 18, 2024 · 1 comment
Labels
Bug Something isn't working

Comments

@ainoske
Copy link

ainoske commented Oct 18, 2024

What area is the issue related to?

Checkout Sheet Kit

What version of the package are you using?

3.0.1

Reproducible sample code

val cartCreateResponse =
        storefront.mutationAsSingle(
            CartCreateMutation(
                CartInput(
                    buyerIdentity =
                        Optional.presentIfNotNull(
                            CartBuyerIdentityInput(
                                customerAccessToken =
                                    Optional.presentIfNotNull(
                                        customerAccessToken.accessToken
                                    ),
                                countryCode = Optional.presentIfNotNull(countryCode)
                            )
                        ),
                    lines =
                        Optional.presentIfNotNull(
                            listOf(
                                CartLineInput(
                                    quantity = Optional.presentIfNotNull(1),
                                    merchandiseId = productVariantId,
                                    sellingPlanId = Optional.presentIfNotNull(sellingPlanId),
                                )
                            )
                        ),
                    attributes =
                        Optional.presentIfNotNull(
                            listOf(
                                AttributeInput(
                                    key = "id",
                                    value = id.raw
                                )
                            )
                        ),
                    note = Optional.presentIfNotNull("")
                ),
                countryCode = countryCode,
                languageCode = languageCode,
            )
        )

ShopifyCheckoutSheetKit.present(
            checkoutUrl = result.checkoutUrl.toString(),
            context = context as ComponentActivity,
            checkoutEventProcessor =
                object : DefaultCheckoutEventProcessor(context) {
                    override fun onCheckoutCanceled() {}

                    override fun onCheckoutCompleted(checkoutCompletedEvent: CheckoutCompletedEvent) { }

                    override fun onCheckoutFailed(error: CheckoutException) {
                        checkoutError = error.errorDescription
                    }

                    override fun onWebPixelEvent(event: PixelEvent) {
                        if (event is StandardPixelEvent) {
                            when (event.name) {
                                "checkout_shipping_info_submitted" -> { }

                                "checkout_completed" -> { }

                                "payment_info_submitted" -> { }
                            }
                        }
                    }
                }
        )

Steps to Reproduce

  1. Create a cart for the target product using CartCreateMutationAPI for pre-payment.
  2. Load it with CheckoutSheetKit using the checkoutURL obtained from the response.

Expected Behavior

The checkout screen must be displayed correctly and payment can be made.

Actual Behavior

HTTP429 error after such behavior that the Checkout screen is generated repeatedly.

Screenshots/Videos/Log output

IMG_7999.mp4

Storefront domain

no response

@ainoske ainoske added Bug Something isn't working untriaged The issue has not yet been checked by the team labels Oct 18, 2024
@kiftio
Copy link
Contributor

kiftio commented Oct 18, 2024

Hi, I'd thought this may be related to the error recovery setup, but when I test via our MobileBuyIntegration sample app (with the server always returning 429) all seems OK there. The initial view attempts to recover from the error in a fallback view. But the fallback does not attempt to recover again.

Also, this should all happen within the same (un-dismissed) dialog instance. In the video, it looks like the dialog is being dismissed and re-opened.

Could I ask for a few more details:

  • Could you add a log on the line before you call ShopifyCheckoutSheetKit.present(), to double check present() is not being called multiple times. This should be the only place that leads to a dialog.show() call
  • Which shop is this related to? To help see if we have any relevant logs
  • Could youCheck the logs for onCheckoutFailed() - is there any initial error (other than a HTTP 429) being received?

Thanks

@kiftio kiftio removed the untriaged The issue has not yet been checked by the team label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants