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

add catalog item and category to purchase via transactions api

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

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

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

)

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

如果有人有教程,将不胜感激。

您需要使用 CreateOrder 来创建项目订单。然后,您可以将 order_id 传递给 Transactions API(您将在支付表单后调用 Charge 端点)。看这里:https://docs.connect.squareup.com/payments/transactions/cookbook/itemize-transactions

我明白了。 我必须使用订单 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...