通过交易api添加要购买的目录项和类别

问题描述 投票:0回答:2

我使用支付表格和方形交易api来检索付款,但它在方形仪表板中显示未分类。有没有一种简单的方法将目录项添加到我已编写的事务api代码中?

我可以简单地将链接添加到request_body数组下的新订单项吗?

$request_body = array (
 "card_nonce" => $nonce,

)

$txRequest['item_id'] = "my item id";

如果有人有一个非常感谢的教程。

square-connect
2个回答
1
投票

我想到了。我必须使用订单api创建和订购,然后将order_id传递给收费代码。在PHP中它看起来像这样。

.......create order here using orders api(code not shown)......

...pass order_id to charge(in php)...
    mix of variables for nonce, etc...
............

$request_body = array (
 "card_nonce" => $nonce,
  "buyer_email_address" => $be,
  "note" => "online Laser Tag reservation",

   "amount_money" => array (
  "amount" => $totalCost,
  "currency" => "USD")

  "order_id" => $my_order_id,

   "idempotency_key" => uniqid()

};

...try/catch statements...


0
投票

您将要使用CreateOrder创建项目顺序。然后你可以将order_id传递给Transactions API(你将在付款表格之后使用它来调用Charge端点)。见这里:https://docs.connect.squareup.com/payments/transactions/cookbook/itemize-transactions

© www.soinside.com 2019 - 2024. All rights reserved.