通过网站上的 API 创建的方形订单不会显示在仪表板上 [英] Square orders create via API on website don't show on dashboard

查看:28
本文介绍了通过网站上的 API 创建的方形订单不会显示在仪表板上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用 square/connect-php-sdk createOrder 创建一个 Square Order.

I'm currently using square/connect-php-sdk createOrder to create a Square Order.

$api_config = new SquareConnect\Configuration();
$api_config->setAccessToken($access_token);
$api_config->setHost($host);
$api_client = new SquareConnect\ApiClient($api_config);
$apiInstance = new SquareConnect\Api\OrdersApi($api_client);
$orderRequest = new SquareConnect\Model\CreateOrderRequest();
$orderRequest->setIdempotencyKey(uniqid());
$order = new SquareConnect\Model\Order();
$money = new SquareConnect\Model\Money();
$money->setAmount(intval(500))
    ->setCurrency("USD");
$line_item = new SquareConnect\Model\OrderLineItem();
$line_item->setCatalogObjectId(<square item id>)
    ->setQuantity("1")
    ->setBasePriceMoney($money);
$line_items[] = $line_item;
$order->setLineItems($line_items);
$orderRequest->setOrder($order);
$result = $apiInstance->createOrder($location_id, $orderRequest);

这将返回我在本地存储的订单 ID(以及其他订单数据).然后我使用 Square Payment Form 处理信用卡:https://developer.squareup.com/docs/payment-form/payment-form-walkthrough

This returns an Order ID (along with other order data) which I store locally. I then process a credit card using the Square Payment Form: https://developer.squareup.com/docs/payment-form/payment-form-walkthrough

这给了我一个随机数,然后我将它与订单 ID 和价格一起发送.

This gives me a nonce which I then send with the Order ID and the price.

$apiInstance = new SquareConnect\Api\PaymentsApi($api_client);
$paymentRequest = new SquareConnect\Model\CreatePaymentRequest();
$paymentRequest->setIdempotencyKey(uniqid());
$paymentRequest->setLocationId($location_id);
$money = new SquareConnect\Model\Money();
$money->setAmount(intval($total_cost))
    ->setCurrency("USD");
$paymentRequest->setAmountMoney($money);
$paymentRequest->setOrderId($sq_order_id);
$paymentRequest->setSourceId($nonce);
$result = $apiInstance->createPayment($paymentRequest);

这给了我一个付款 ID(以及其他付款数据).在 Square 仪表板上,我可以在交易部分看到交易,但仪表板的订单部分是空的.

This gives me a Payment ID (along with other payment data). On the Square Dashboard, I am able to see the transaction in the Transactions section, but the Orders section of the dashboard is empty.

我的问题是如何让它显示在订单部分?

My question is How do I get it to show in the Orders section?

推荐答案

为了让订单显示在您的仪表板中,您需要做两件事:1.支付订单(听起来你做了这部分)2. 在 CreateOrder 请求中包含一个 fulfillments 参数:https://developer.squareup.com/docs/orders-api/order-ahead-usecase#add-fulfillment-信息到取件订单

In order for the order to show up in your dashboard you need to do two things: 1. Pay for the order (it sounds like you did this part) 2. Include a fulfillments parameter in the CreateOrder request: https://developer.squareup.com/docs/orders-api/order-ahead-usecase#add-fulfillment-information-to-make-a-pickup-order

这篇关于通过网站上的 API 创建的方形订单不会显示在仪表板上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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