Skip to content

Instantly share code, notes, and snippets.

@islandskater43
Last active February 17, 2016 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save islandskater43/738e82afd81cc4214967 to your computer and use it in GitHub Desktop.
Save islandskater43/738e82afd81cc4214967 to your computer and use it in GitHub Desktop.
PHP GetOrderReferenceDetails
<?php
namespace PayWithAmazon;
require_once 'Client.php';
// Your Login and Pay with Amazon keys are available in your Seller Central account
// PHP Associative array
$config = array('merchant_id' => 'YOUR_MERCHANT_ID',
'access_key' => 'YOUR_ACCESS_KEY',
'secret_key' => 'YOUR_SECRET_KEY',
'client_id' => 'YOUR_LOGIN_WITH_AMAZON_CLIENT_ID',
'region' => 'REGION',
'sandbox' => true );
// Instantiate the client class with the config type
$client = new Client($config);
$requestParameters = array();
// AMAZON_ORDER_REFERENCE_ID is obtained from the Pay with Amazon Address/Wallet widgets
// ACCESS_TOKEN is obtained from the GET parameter from the URL.
// Required Parameter
$requestParameters['amazon_order_reference_id'] = 'AMAZON_ORDER_REFERENCE_ID';
// Optional Parameter
$requestParameters['address_consent_token'] = 'ACCESS_TOKEN';
$response = $client->getOrderReferenceDetails($requestParameters);
// Retrieve the OrderReferenceObject's current state
$state = json_decode($response->toJson())->GetOrderReferenceDetailsResult->OrderReferenceDetails->OrderReferenceStatus->State;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment