【问题标题】:Checkout API get email of buyer on redirectCheckout API 在重定向时获取买家的电子邮件
【发布时间】:2019-05-16 10:39:33
【问题描述】:

所以使用 square checkout api,在用户使用 square checkout 后,我​​得到一个 transaction id 和 checkout id,但似乎没有办法获取买家在结帐时输入的信息。我怎样才能得到该买家的电子邮件和姓名?

尝试通过结帐 ID 获取信息,但似乎不可能

// pull out the transaction ID returned by Square Checkout
$returnedTransactionId = $_GET["transactionId"];

// Create a new API object to verify the transaction
$transactionClient = new \SquareConnect\Api\TransactionsApi($defaultApiClient);

// Ping the Transactions API endpoint for transaction details
try {

  // Get transaction details for this order from the Transactions API endpoint
  $apiResponse = $transactionClient->retrieveTransaction(
    $locationId,
    $returnedTransactionId
  );

} catch (Exception $e) {
  echo "The SquareConnect\Configuration object threw an exception while " .
       "calling TransactionsApi->retrieveTransaction: ",
       $e->getMessage(), PHP_EOL;
  exit;
}

【问题讨论】:

    标签: square


    【解决方案1】:

    一旦您像以前一样检索事务,response 将有一个名为 tenders 的字段,在此数组字段中您将找到一个名为 customer_id 的字段。使用此customer_id,您可以致电RetrieveCustomer 并获取客户的信息,包括他们的姓名和电子邮件。

    【讨论】:

      猜你喜欢
      • 2022-01-09
      • 2015-05-14
      • 2014-11-25
      • 1970-01-01
      • 2014-09-20
      • 2012-01-24
      • 2013-05-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多