I’m using Square order checkout with CreateOrderRequest & CreateCheckoutRequest.
How I can retrieve the payment id after receiving the payment confirmation?
This is the request:
$create_order_request = new Square\Models\CreateOrderRequest();
$create_order_request->setOrder($order);
$checkout_request = new Square\Models\CreateCheckoutRequest(uniqid(), $create_order_request);
$checkout_request->setRedirectUrl($conf_url);
$response = $checkout_api->createCheckout($settings['locationid'], $checkout_request);
header('Location: ' . $response->getResult()->getCheckout()->getCheckoutPageUrl());
// And the succcessful payment confirmation:
$orders_api = $client->getOrdersApi();
$response = $orders_api->retrieveOrder($_GET["transactionId"]);
if ($response->isError()) {
// Handle errors
} else {
// Retrieve payment id
}
6 posts - 3 participants