我目前正在使用 square/connect-php-sdk createOrder 創(chuàng)建 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);這將返回我在本地存儲(chǔ)的訂單 ID(以及其他訂單數(shù)據(jù))。然后我使用 Square Payment Form 處理信用卡:https ://developer.squareup.com/docs/payment-form/payment-form-walkthrough這給了我一個(gè)隨機(jī)數(shù),然后我將其與訂單 ID 和價(jià)格一起發(fā)送。$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);這給了我一個(gè)付款 ID(連同其他付款數(shù)據(jù))。在 Square Dashboard 上,我可以在 Transactions 部分看到交易,但 Dashboard 的 Orders 部分是空的。我的問題是如何讓它顯示在訂單部分?
1 回答

素胚勾勒不出你
TA貢獻(xiàn)1827條經(jīng)驗(yàn) 獲得超9個(gè)贊
為了讓訂單顯示在您的儀表板中,您需要做兩件事:1. 為訂單付款(聽起來像是您做了這部分) 2.在請(qǐng)求中包含一個(gè)fulfillments
參數(shù): https://developer.squareup。 com/docs/orders-api/order-ahead-usecase#add-fulfillment-information-to-make-a-pickup-orderCreateOrder
- 1 回答
- 0 關(guān)注
- 102 瀏覽
添加回答
舉報(bào)
0/150
提交
取消