Skip to content

Commit

Permalink
Amazon Pay API SDK PHP 2.6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Nayan Kumar S committed Sep 27, 2023
1 parent ab02d97 commit 3adb8d2
Show file tree
Hide file tree
Showing 5 changed files with 513 additions and 17 deletions.
21 changes: 19 additions & 2 deletions Amazon/Pay/API/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
require_once 'ReportingClientInterface.php';
require_once 'HttpCurl.php';

class Client implements ClientInterface, ReportingClientInterface
class Client implements ClientInterface, ReportingClientInterface, MerchantOnboardingClientInterface
{
const SDK_VERSION = '2.6.3';
const SDK_VERSION = '2.6.4';
const SDK_LANGUAGE = 'PHP';
const HASH_ALGORITHM = 'sha256';
const API_VERSION = 'v2';
const ACCOUNT_MANAGEMENT = '/merchantAccounts';

private $config = array();

Expand Down Expand Up @@ -721,4 +722,20 @@ public function finalizeCheckoutSession($checkoutSessionId, $payload, $headers =
return $this->apicall('POST', self::API_VERSION . '/checkoutSessions/' . $checkoutSessionId . '/finalize', $payload , $headers);
}

// ----------------------------------- Merchant Onboarding & Account Management APIs -----------------------------------

public function registerAmazonPayAccount($payload, $headers = null)
{
return $this->apiCall('POST', self::API_VERSION . self::ACCOUNT_MANAGEMENT, $payload, $headers);
}

public function updateAmazonPayAccount($merchantAccountId, $payload, $headers = null)
{
return $this->apiCall('PATCH', self::API_VERSION . self::ACCOUNT_MANAGEMENT . '/' . $merchantAccountId, $payload, $headers);
}

public function deleteAmazonPayAccount($merchantAccountId, $headers = null)
{
return $this->apiCall('DELETE', self::API_VERSION . self::ACCOUNT_MANAGEMENT . '/' . $merchantAccountId, null, $headers);
}
}
36 changes: 36 additions & 0 deletions Amazon/Pay/API/MerchantOnboardingClientInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
namespace Amazon\Pay\API;

/* Interface class to showcase the public API methods for Amazon Pay */
interface MerchantOnboardingClientInterface
{
// ----------------------------------- Merchant Onboarding & Account Management APIs --------------------

/* Amazon Checkout v2 - Register Amazon Pay Account
*
* Creates a non-logginable account for your merchant partners. These would be special accounts through which Merchants would not be able to login to Amazon or access Seller Central.
*
* @param payload - [String in JSON format] or [array]
* @optional headers - [indexed array of string key-value pairs]
*/
public function registerAmazonPayAccount($payload, $headers = null);

/* Amazon Checkout v2 - Update Amazon Pay Account
*
* Updates a merchant account for the given Merchant Account ID. We would be allowing our partners to update only a certain set of fields which won’t change the legal business entity itself.
*
* @param merchantAccountId - [String] - Merchant Account ID
* @param payload - [String in JSON format] or [array]
* @optional headers - [indexed array of string key-value pairs]
*/
public function updateAmazonPayAccount($merchantAccountId, $payload, $headers = null);

/* Amazon Checkout v2 - Delete Amazon Pay Account
*
* Deletes the Merchant account for the given Merchant Account ID. Partners can close the merchant accounts created for their merchant partners.
*
* @param merchantAccountId - [String] - Merchant Account ID
* @optional headers - [indexed array of string key-value pairs]
*/
public function deleteAmazonPayAccount($merchantAccountId, $headers = null);
}
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Version 2.6.4 - September 2023
* Introducing new Merchant Onboarding & Account Management APIs, which allows our partners to onboard merchants programatically and as part of account management offer them creation, updation and deletion/dissociation capability.
* Added the Sample Code snippets for the Charge APIs, Charge Permission APIs and Refund APIs.

### Version 2.6.3 - September 2023
* Introducing new API called finalizeCheckoutSession which validates critical attributes in merchantMetadata then processes payment. Use this API to process payments for JavaScript-based integrations.
* Corrected README.md file related to finalizeCheckoutSession API.
Expand Down

0 comments on commit 3adb8d2

Please sign in to comment.