Quantcast
Channel: Square Developer Forums - Latest topics
Viewing all articles
Browse latest Browse all 1334

Retrieve payment Id

$
0
0

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

Read full topic


Viewing all articles
Browse latest Browse all 1334

Trending Articles