Last active
February 17, 2016 09:51
-
-
Save islandskater43/738e82afd81cc4214967 to your computer and use it in GitHub Desktop.
PHP GetOrderReferenceDetails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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