结帐 API 在重定向时获取买家的电子邮件

Checkout API get email of buyer on redirect

所以使用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;
}

一旦您像您已经在做的那样检索交易,response will have a field called tenders, and in this array field you'll find a field called customer_id. Using this customer_id, you can call RetrieveCustomer 并获取客户的信息,包括他们的姓名和电子邮件。