Shopify Web结帐问题 [英] Shopify Web Checkout Issue

查看:179
本文介绍了Shopify Web结帐问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 WebCheckout .之后,我得到了该Checkout回调的回调.

I am doing WebCheckout. After that, I am getting a callback of that Checkout callback.

我已按照这里.

GraphClient client = ...;
ID paymentId = ...;

Storefront.QueryRootQuery query = Storefront.query(rootQuery -> rootQuery
    .node(paymentId, nodeQuery -> nodeQuery
        .onPayment(paymentQuery -> paymentQuery
        .checkout(checkoutQuery -> checkoutQuery
                    .ready()
            .order(orderQuery -> orderQuery
            .processedAt()
            .orderNumber()
            .totalPrice()))
        .errorMessage()
        .ready()
        )
    )
);

================================================ ======================

======================================================================

我面临以下问题:

它不应该是PaymentId,它是checkoutId,同时会收到

It shouldn't be paymentId, It is checkoutId while will be received in response of this request.

Storefront.QueryRootQuery query = Storefront.query(rootQuery -> rootQuery
    .node(paymentId, nodeQuery -> nodeQuery
        .onPayment(paymentQuery -> paymentQuery
        .checkout(checkoutQuery -> checkoutQuery
            .order(orderQuery -> orderQuery
            .processedAt()
            .orderNumber()
            .totalPrice()))
        .errorMessage()
        .ready()
        )
    )
);

-2.1如果删除了以下行,则我可以获得一些数据:

.onPayment(paymentQuery -> paymentQuery

因此,代码将如下所示:

So, code will be look like this :

.node(paymentId) { nodeQuery: NodeQuery ->
    nodeQuery.onCheckout { checkoutQuery: CheckoutQuery ->
        checkoutQuery
            .createdAt()
            .updatedAt()
            .completedAt()
            .email()
            .ready()
            .order {
                it.orderNumber()
            }
    }
}

在上面的代码中,我总是得到 ready = true (无论是否购买了该产品). ready字段在retryHandler函数内部使用.

In above code, I am always getting ready=true (Whether I have purchased the product or not). The ready field is using inside the retryHandler function.

RetryHandler.exponentialBackoff(500, TimeUnit.MILLISECONDS, 1.2f)
.whenResponse(
      response -> ((Storefront.Payment) ((GraphResponse<Storefront.QueryRoot>) response).data().getNode()).getReady() == false
    )
    .maxCount(12)
    .build()

-2.2,我收到 order = null .我需要显示orderNumber,所以如何获取呢?

================================================ ==================

- 2.2, I am getting order=null. I need orderNumber to display, so how can I get that?

==================================================================

  • 在第1点中,可能是键入错误,它必须显示checkoutId而不是paymentId.因为这会使开发人员感到困惑.
  • 在第2点中,它必须返回所需的数据.
  • 在Point 2.1 中,成功下订单后必须更改ready字段.
  • 在Point 2.2 中,order字段不得为空.
  • In Point 1, It might be some typing mistake, instead of paymentId, it must display checkoutId. As it is confusing to the developer.
  • In Point 2, It must return the needed data.
  • In Point 2.1, The ready field must be changed when the order is successfully placed.
  • In Point 2.2, The order field must not be null.

推荐答案

找到了解决方案,

第1点,

  • 这是checkoutId而不是paymentId

第2点,

注意:请注意,要获取更新结果,您必须从GraphClient对象中删除defaultCachePolicy,在该对象中我们将商店设置为Shopify.

NOTE: Please make a note that, for getting updated result, you have to remove the defaultCachePolicy from the GraphClient object where we are setting up our shop to Shopify.

现在,在轮询结帐完成时,将HTTPCachePolicy传递为

Now, while Polling for checkout completion, pass HTTPCachePolicy as

HttpCachePolicy.Default.NETWORK_ONLY

查询如下,

rootQuery.node(paymentId) { nodeQuery: NodeQuery ->
    nodeQuery.onCheckout { checkoutQuery: CheckoutQuery ->
        checkoutQuery
            .createdAt()
            .updatedAt()
            .completedAt()
            .email()
            .ready()
            .order {
                it.orderNumber()
            }
    }
}

这篇关于Shopify Web结帐问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆