Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Latest commit

 

History

History
2805 lines (1675 loc) · 64 KB

README.md

File metadata and controls

2805 lines (1675 loc) · 64 KB

Getting started

Mundipagg API

How to Build

The generated code has dependencies over external libraries like UniRest. These dependencies are defined in the composer.json file that comes with the SDK. To resolve these dependencies, we use the Composer package manager which requires PHP greater than 5.3.2 installed in your system. Visit https://getcomposer.org/download/ to download the installer file for Composer and run it in your system. Open command prompt and type composer --version. This should display the current version of the Composer installed if the installation was successful.

  • Using command line, navigate to the directory containing the generated files (including composer.json) for the SDK.
  • Run the command composer install. This should install all the required dependencies and create the vendor directory in your project directory.

Building SDK - Step 1

[For Windows Users Only] Configuring CURL Certificate Path in php.ini

CURL used to include a list of accepted CAs, but no longer bundles ANY CA certs. So by default it will reject all SSL certificates as unverifiable. You will have to get your CA's cert and point curl at it. The steps are as follows:

  1. Download the certificate bundle (.pem file) from https://curl.haxx.se/docs/caextract.html on to your system.
  2. Add curl.cainfo = "PATH_TO/cacert.pem" to your php.ini file located in your php installation. “PATH_TO” must be an absolute path containing the .pem file.
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
;curl.cainfo =

How to Use

The following section explains how to use the MundiAPI library in a new project.

1. Open Project in an IDE

Open an IDE for PHP like PhpStorm. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.

Open project in PHPStorm - Step 1

Click on Open in PhpStorm to browse to your generated SDK directory and then click OK.

Open project in PHPStorm - Step 2

2. Add a new Test Project

Create a new directory by right clicking on the solution name as shown below:

Add a new project in PHPStorm - Step 1

Name the directory as "test"

Add a new project in PHPStorm - Step 2

Add a PHP file to this project

Add a new project in PHPStorm - Step 3

Name it "testSDK"

Add a new project in PHPStorm - Step 4

Depending on your project setup, you might need to include composer's autoloader in your PHP code to enable auto loading of classes.

require_once "../vendor/autoload.php";

It is important that the path inside require_once correctly points to the file autoload.php inside the vendor directory created during dependency installations.

Add a new project in PHPStorm - Step 4

After this you can add code to initialize the client library and acquire the instance of a Controller class. Sample code to initialize the client library and using controller methods is given in the subsequent sections.

3. Run the Test Project

To run your project you must set the Interpreter for your project. Interpreter is the PHP engine installed on your computer.

Open Settings from File menu.

Run Test Project - Step 1

Select PHP from within Languages & Frameworks

Run Test Project - Step 2

Browse for Interpreters near the Interpreter option and choose your interpreter.

Run Test Project - Step 3

Once the interpreter is selected, click OK

Run Test Project - Step 4

To run your project, right click on your PHP file inside your Test project and click on Run

Run Test Project - Step 5

How to Test

Unit tests in this SDK can be run using PHPUnit.

  1. First install the dependencies using composer including the require-dev dependencies.
  2. Run vendor\bin\phpunit --verbose from commandline to execute tests. If you have installed PHPUnit globally, run tests using phpunit --verbose instead.

You can change the PHPUnit test configuration in the phpunit.xml file.

Initialization

Authentication

In order to setup authentication and initialization of the API client, you need the following information.

Parameter Description
basicAuthUserName The username to use with basic authentication
basicAuthPassword The password to use with basic authentication

API client can be initialized as following.

$basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication
$basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication

$client = new MundiAPILib\MundiAPIClient($basicAuthUserName, $basicAuthPassword);

Class Reference

List of Controllers

Class: ChargesController

Get singleton instance

The singleton instance of the ChargesController class can be accessed from the API Client.

$charges = $client->getCharges();

Method: getCharge

Get a charge from its id

function getCharge($chargeId)

Parameters

Parameter Tags Description
chargeId Required Charge id

Example Usage

$chargeId = 'charge_id';

$result = $charges->getCharge($chargeId);

Method: retryCharge

Retries a charge

function retryCharge($chargeId)

Parameters

Parameter Tags Description
chargeId Required Charge id

Example Usage

$chargeId = 'charge_id';

$result = $charges->retryCharge($chargeId);

Method: createCharge

Creates a new charge

function createCharge($request)

Parameters

Parameter Tags Description
request Required Request for creating a charge

Example Usage

$request = new CreateChargeRequest();

$result = $charges->createCharge($request);

Method: updateChargeCard

Updates the card from a charge

function updateChargeCard(
        $chargeId,
        $request)

Parameters

Parameter Tags Description
chargeId Required Charge id
request Required Request for updating a charge's card

Example Usage

$chargeId = 'charge_id';
$request = new UpdateChargeCardRequest();

$result = $charges->updateChargeCard($chargeId, $request);

Method: updateChargePaymentMethod

Updates a charge's payment method

function updateChargePaymentMethod(
        $chargeId,
        $request)

Parameters

Parameter Tags Description
chargeId Required Charge id
request Required Request for updating the payment method from a charge

Example Usage

$chargeId = 'charge_id';
$request = new UpdateChargePaymentMethodRequest();

$result = $charges->updateChargePaymentMethod($chargeId, $request);

Method: cancelCharge

Cancel a charge

function cancelCharge(
        $chargeId,
        $request = null)

Parameters

Parameter Tags Description
chargeId Required Charge id
request Optional Request for cancelling a charge

Example Usage

$chargeId = 'charge_id';
$request = new CreateCancelChargeRequest();

$result = $charges->cancelCharge($chargeId, $request);

Method: captureCharge

Captures a charge

function captureCharge(
        $chargeId,
        $request = null)

Parameters

Parameter Tags Description
chargeId Required Charge id
request Optional Request for capturing a charge

Example Usage

$chargeId = 'charge_id';
$request = new CreateCaptureChargeRequest();

$result = $charges->captureCharge($chargeId, $request);

Method: updateChargeMetadata

Updates the metadata from a charge

function updateChargeMetadata(
        $chargeId,
        $request)

Parameters

Parameter Tags Description
chargeId Required The charge id
request Required Request for updating the charge metadata

Example Usage

$chargeId = 'charge_id';
$request = new UpdateMetadataRequest();

$result = $charges->updateChargeMetadata($chargeId, $request);

Method: getCharges

Lists all charges

function getCharges(
        $page = null,
        $size = null,
        $code = null,
        $status = null,
        $paymentMethod = null,
        $customerId = null,
        $orderId = null,
        $createdSince = null,
        $createdUntil = null)

Parameters

Parameter Tags Description
page Optional Page number
size Optional Page size
code Optional Filter for charge's code
status Optional Filter for charge's status
paymentMethod Optional Filter for charge's payment method
customerId Optional Filter for charge's customer id
orderId Optional Filter for charge's order id
createdSince Optional Filter for the beginning of the range for charge's creation
createdUntil Optional Filter for the end of the range for charge's creation

Example Usage

$page = 163;
$size = 163;
$code = 'code';
$status = 'status';
$paymentMethod = 'payment_method';
$customerId = 'customer_id';
$orderId = 'order_id';
$createdSince = date("D M d, Y G:i");
$createdUntil = date("D M d, Y G:i");

$result = $charges->getCharges($page, $size, $code, $status, $paymentMethod, $customerId, $orderId, $createdSince, $createdUntil);

Back to List of Controllers

Class: CustomersController

Get singleton instance

The singleton instance of the CustomersController class can be accessed from the API Client.

$customers = $client->getCustomers();

Method: createCustomer

Creates a new customer

function createCustomer($request)

Parameters

Parameter Tags Description
request Required Request for creating a customer

Example Usage

$request = new CreateCustomerRequest();

$result = $customers->createCustomer($request);

Method: getCustomer

Get a customer

function getCustomer($customerId)

Parameters

Parameter Tags Description
customerId Required Customer Id

Example Usage

$customerId = 'customer_id';

$result = $customers->getCustomer($customerId);

Method: updateCard

Updates a card

function updateCard(
        $customerId,
        $cardId,
        $request)

Parameters

Parameter Tags Description
customerId Required Customer Id
cardId Required Card id
request Required Request for updating a card

Example Usage

$customerId = 'customer_id';
$cardId = 'card_id';
$request = new UpdateCardRequest();

$result = $customers->updateCard($customerId, $cardId, $request);

Method: updateAddress

Updates an address

function updateAddress(
        $customerId,
        $addressId,
        $request)

Parameters

Parameter Tags Description
customerId Required Customer Id
addressId Required Address Id
request Required Request for updating an address

Example Usage

$customerId = 'customer_id';
$addressId = 'address_id';
$request = new UpdateAddressRequest();

$result = $customers->updateAddress($customerId, $addressId, $request);

Method: getAddress

Get a customer's address

function getAddress(
        $customerId,
        $addressId)

Parameters

Parameter Tags Description
customerId Required Customer id
addressId Required Address Id

Example Usage

$customerId = 'customer_id';
$addressId = 'address_id';

$result = $customers->getAddress($customerId, $addressId);

Method: deleteAddress

Delete a Customer's address

function deleteAddress(
        $customerId,
        $addressId)

Parameters

Parameter Tags Description
customerId Required Customer Id
addressId Required Address Id

Example Usage

$customerId = 'customer_id';
$addressId = 'address_id';

$result = $customers->deleteAddress($customerId, $addressId);

Method: deleteCard

Delete a customer's card

function deleteCard(
        $customerId,
        $cardId)

Parameters

Parameter Tags Description
customerId Required Customer Id
cardId Required Card Id

Example Usage

$customerId = 'customer_id';
$cardId = 'card_id';

$result = $customers->deleteCard($customerId, $cardId);

Method: createAddress

Creates a new address for a customer

function createAddress(
        $customerId,
        $request)

Parameters

Parameter Tags Description
customerId Required Customer Id
request Required Request for creating an address

Example Usage

$customerId = 'customer_id';
$request = new CreateAddressRequest();

$result = $customers->createAddress($customerId, $request);

Method: getCard

Get a customer's card

function getCard(
        $customerId,
        $cardId)

Parameters

Parameter Tags Description
customerId Required Customer id
cardId Required Card id

Example Usage

$customerId = 'customer_id';
$cardId = 'card_id';

$result = $customers->getCard($customerId, $cardId);

Method: createCard

Creates a new card for a customer

function createCard(
        $customerId,
        $request)

Parameters

Parameter Tags Description
customerId Required Customer id
request Required Request for creating a card

Example Usage

$customerId = 'customer_id';
$request = new CreateCardRequest();

$result = $customers->createCard($customerId, $request);

Method: updateCustomer

Updates a customer

function updateCustomer(
        $customerId,
        $request)

Parameters

Parameter Tags Description
customerId Required Customer id
request Required Request for updating a customer

Example Usage

$customerId = 'customer_id';
$request = new UpdateCustomerRequest();

$result = $customers->updateCustomer($customerId, $request);

Method: deleteAccessTokens

Delete a Customer's access tokens

function deleteAccessTokens($customerId)

Parameters

Parameter Tags Description
customerId Required Customer Id

Example Usage

$customerId = 'customer_id';

$result = $customers->deleteAccessTokens($customerId);

Method: getCustomers

Get all Customers

function getCustomers(
        $name = null,
        $document = null,
        $page = 1,
        $size = 10,
        $email = null)

Parameters

Parameter Tags Description
name Optional Name of the Customer
document Optional Document of the Customer
page Optional DefaultValue Current page the the search
size Optional DefaultValue Quantity pages of the search
email Optional Customer's email

Example Usage

$name = 'name';
$document = 'document';
$page = 1;
$size = 10;
$email = 'email';

$result = $customers->getCustomers($name, $document, $page, $size, $email);

Method: getAccessToken

Get a Customer's access token

function getAccessToken(
        $customerId,
        $tokenId)

Parameters

Parameter Tags Description
customerId Required Customer Id
tokenId Required Token Id

Example Usage

$customerId = 'customer_id';
$tokenId = 'token_id';

$result = $customers->getAccessToken($customerId, $tokenId);

Method: createAccessToken

Creates a access token for a customer

function createAccessToken(
        $customerId,
        $request)

Parameters

Parameter Tags Description
customerId Required Customer Id
request Required Request for creating a access token

Example Usage

$customerId = 'customer_id';
$request = new CreateAccessTokenRequest();

$result = $customers->createAccessToken($customerId, $request);

Method: deleteAccessToken

Delete a customer's access token

function deleteAccessToken(
        $customerId,
        $tokenId)

Parameters

Parameter Tags Description
customerId Required Customer Id
tokenId Required Token Id

Example Usage

$customerId = 'customer_id';
$tokenId = 'token_id';

$result = $customers->deleteAccessToken($customerId, $tokenId);

Method: updateCustomerMetadata

Updates the metadata a customer

function updateCustomerMetadata(
        $customerId,
        $request)

Parameters

Parameter Tags Description
customerId Required The customer id
request Required Request for updating the customer metadata

Example Usage

$customerId = 'customer_id';
$request = new UpdateMetadataRequest();

$result = $customers->updateCustomerMetadata($customerId, $request);

Method: getAccessTokens

Get all access tokens from a customer

function getAccessTokens(
        $customerId,
        $page = null,
        $size = null)

Parameters

Parameter Tags Description
customerId Required Customer Id
page Optional Page number
size Optional Page size

Example Usage

$customerId = 'customer_id';
$page = 163;
$size = 163;

$result = $customers->getAccessTokens($customerId, $page, $size);

Method: getAddresses

Gets all adressess from a customer

function getAddresses(
        $customerId,
        $page = null,
        $size = null)

Parameters

Parameter Tags Description
customerId Required Customer id
page Optional Page number
size Optional Page size

Example Usage

$customerId = 'customer_id';
$page = 163;
$size = 163;

$result = $customers->getAddresses($customerId, $page, $size);

Method: getCards

Get all cards from a customer

function getCards(
        $customerId,
        $page = null,
        $size = null)

Parameters

Parameter Tags Description
customerId Required Customer Id
page Optional Page number
size Optional Page size

Example Usage

$customerId = 'customer_id';
$page = 163;
$size = 163;

$result = $customers->getCards($customerId, $page, $size);

Back to List of Controllers

Class: InvoicesController

Get singleton instance

The singleton instance of the InvoicesController class can be accessed from the API Client.

$invoices = $client->getInvoices();

Method: getInvoice

Gets an invoice

function getInvoice($invoiceId)

Parameters

Parameter Tags Description
invoiceId Required Invoice Id

Example Usage

$invoiceId = 'invoice_id';

$result = $invoices->getInvoice($invoiceId);

Method: cancelInvoice

Cancels an invoice

function cancelInvoice($invoiceId)

Parameters

Parameter Tags Description
invoiceId Required Invoice id

Example Usage

$invoiceId = 'invoice_id';

$result = $invoices->cancelInvoice($invoiceId);

Method: updateInvoiceMetadata

Updates the metadata from an invoice

function updateInvoiceMetadata(
        $invoiceId,
        $request)

Parameters

Parameter Tags Description
invoiceId Required The invoice id
request Required Request for updating the invoice metadata

Example Usage

$invoiceId = 'invoice_id';
$request = new UpdateMetadataRequest();

$result = $invoices->updateInvoiceMetadata($invoiceId, $request);

Method: getInvoices

Gets all invoices

function getInvoices(
        $page = null,
        $size = null,
        $code = null,
        $customerId = null,
        $subscriptionId = null,
        $createdSince = null,
        $createdUntil = null,
        $status = null,
        $dueSince = null,
        $dueUntil = null)

Parameters

Parameter Tags Description
page Optional Page number
size Optional Page size
code Optional Filter for Invoice's code
customerId Optional Filter for Invoice's customer id
subscriptionId Optional Filter for Invoice's subscription id
createdSince Optional Filter for Invoice's creation date start range
createdUntil Optional Filter for Invoices creation date end range
status Optional Filter for Invoice's status
dueSince Optional Filter for Invoice's due date start range
dueUntil Optional Filter for Invoice's due date end range

Example Usage

$page = 163;
$size = 163;
$code = 'code';
$customerId = 'customer_id';
$subscriptionId = 'subscription_id';
$createdSince = date("D M d, Y G:i");
$createdUntil = date("D M d, Y G:i");
$status = 'status';
$dueSince = date("D M d, Y G:i");
$dueUntil = date("D M d, Y G:i");

$result = $invoices->getInvoices($page, $size, $code, $customerId, $subscriptionId, $createdSince, $createdUntil, $status, $dueSince, $dueUntil);

Back to List of Controllers

Class: PlansController

Get singleton instance

The singleton instance of the PlansController class can be accessed from the API Client.

$plans = $client->getPlans();

Method: updatePlanItem

Updates a plan item

function updatePlanItem(
        $planId,
        $planItemId,
        $body)

Parameters

Parameter Tags Description
planId Required Plan id
planItemId Required Plan item id
body Required Request for updating the plan item

Example Usage

$planId = 'plan_id';
$planItemId = 'plan_item_id';
$body = new UpdatePlanItemRequest();

$result = $plans->updatePlanItem($planId, $planItemId, $body);

Method: getPlan

Gets a plan

function getPlan($planId)

Parameters

Parameter Tags Description
planId Required Plan id

Example Usage

$planId = 'plan_id';

$result = $plans->getPlan($planId);

Method: createPlanItem

Adds a new item to a plan

function createPlanItem(
        $planId,
        $request)

Parameters

Parameter Tags Description
planId Required Plan id
request Required Request for creating a plan item

Example Usage

$planId = 'plan_id';
$request = new CreatePlanItemRequest();

$result = $plans->createPlanItem($planId, $request);

Method: updatePlan

Updates a plan

function updatePlan(
        $planId,
        $request)

Parameters

Parameter Tags Description
planId Required Plan id
request Required Request for updating a plan

Example Usage

$planId = 'plan_id';
$request = new UpdatePlanRequest();

$result = $plans->updatePlan($planId, $request);

Method: createPlan

Creates a new plan

function createPlan($body)

Parameters

Parameter Tags Description
body Required Request for creating a plan

Example Usage

$body = new CreatePlanRequest();

$result = $plans->createPlan($body);

Method: deletePlan

Deletes a plan

function deletePlan($planId)

Parameters

Parameter Tags Description
planId Required Plan id

Example Usage

$planId = 'plan_id';

$result = $plans->deletePlan($planId);

Method: getPlanItem

Gets a plan item

function getPlanItem(
        $planId,
        $planItemId)

Parameters

Parameter Tags Description
planId Required Plan id
planItemId Required Plan item id

Example Usage

$planId = 'plan_id';
$planItemId = 'plan_item_id';

$result = $plans->getPlanItem($planId, $planItemId);

Method: deletePlanItem

Removes an item from a plan

function deletePlanItem(
        $planId,
        $planItemId)

Parameters

Parameter Tags Description
planId Required Plan id
planItemId Required Plan item id

Example Usage

$planId = 'plan_id';
$planItemId = 'plan_item_id';

$result = $plans->deletePlanItem($planId, $planItemId);

Method: updatePlanMetadata

Updates the metadata from a plan

function updatePlanMetadata(
        $planId,
        $request)

Parameters

Parameter Tags Description
planId Required The plan id
request Required Request for updating the plan metadata

Example Usage

$planId = 'plan_id';
$request = new UpdateMetadataRequest();

$result = $plans->updatePlanMetadata($planId, $request);

Method: getPlans

Gets all plans

function getPlans(
        $page = null,
        $size = null,
        $name = null,
        $status = null,
        $billingType = null,
        $createdSince = null,
        $createdUntil = null)

Parameters

Parameter Tags Description
page Optional Page number
size Optional Page size
name Optional Filter for Plan's name
status Optional Filter for Plan's status
billingType Optional Filter for plan's billing type
createdSince Optional Filter for plan's creation date start range
createdUntil Optional Filter for plan's creation date end range

Example Usage

$page = 121;
$size = 121;
$name = 'name';
$status = 'status';
$billingType = 'billing_type';
$createdSince = date("D M d, Y G:i");
$createdUntil = date("D M d, Y G:i");

$result = $plans->getPlans($page, $size, $name, $status, $billingType, $createdSince, $createdUntil);

Back to List of Controllers

Class: SubscriptionsController

Get singleton instance

The singleton instance of the SubscriptionsController class can be accessed from the API Client.

$subscriptions = $client->getSubscriptions();

Method: updateSubscriptionItem

Updates a subscription item

function updateSubscriptionItem(
        $subscriptionId,
        $itemId,
        $body)

Parameters

Parameter Tags Description
subscriptionId Required Subscription Id
itemId Required Item id
body Required Request for updating a subscription item

Example Usage

$subscriptionId = 'subscription_id';
$itemId = 'item_id';
$body = new UpdateSubscriptionItemRequest();

$result = $subscriptions->updateSubscriptionItem($subscriptionId, $itemId, $body);

Method: createUsage

Creates a usage

function createUsage(
        $subscriptionId,
        $itemId,
        $body)

Parameters

Parameter Tags Description
subscriptionId Required Subscription Id
itemId Required Item id
body Required Request for creating a usage

Example Usage

$subscriptionId = 'subscription_id';
$itemId = 'item_id';
$body = new CreateUsageRequest();

$result = $subscriptions->createUsage($subscriptionId, $itemId, $body);

Method: updateSubscriptionBillingDate

Updates the billing date from a subscription

function updateSubscriptionBillingDate(
        $subscriptionId,
        $request)

Parameters

Parameter Tags Description
subscriptionId Required The subscription id
request Required Request for updating the subscription billing date

Example Usage

$subscriptionId = 'subscription_id';
$request = new UpdateSubscriptionBillingDateRequest();

$result = $subscriptions->updateSubscriptionBillingDate($subscriptionId, $request);

Method: updateSubscriptionCard

Updates the credit card from a subscription

function updateSubscriptionCard(
        $subscriptionId,
        $request)

Parameters

Parameter Tags Description
subscriptionId Required Subscription id
request Required Request for updating a card

Example Usage

$subscriptionId = 'subscription_id';
$request = new UpdateSubscriptionCardRequest();

$result = $subscriptions->updateSubscriptionCard($subscriptionId, $request);

Method: createSubscription

Creates a new subscription

function createSubscription($body)

Parameters

Parameter Tags Description
body Required Request for creating a subscription

Example Usage

$body = new CreateSubscriptionRequest();

$result = $subscriptions->createSubscription($body);

Method: createSubscriptionItem

Creates a new Subscription item

function createSubscriptionItem(
        $subscriptionId,
        $request)

Parameters

Parameter Tags Description
subscriptionId Required Subscription id
request Required Request for creating a subscription item

Example Usage

$subscriptionId = 'subscription_id';
$request = new CreateSubscriptionItemRequest();

$result = $subscriptions->createSubscriptionItem($subscriptionId, $request);

Method: createDiscount

Creates a discount

function createDiscount(
        $subscriptionId,
        $request)

Parameters

Parameter Tags Description
subscriptionId Required Subscription id
request Required Request for creating a discount

Example Usage

$subscriptionId = 'subscription_id';
$request = new CreateDiscountRequest();

$result = $subscriptions->createDiscount($subscriptionId, $request);

Method: getSubscription

Gets a subscription

function getSubscription($subscriptionId)

Parameters

Parameter Tags Description
subscriptionId Required Subscription id

Example Usage

$subscriptionId = 'subscription_id';

$result = $subscriptions->getSubscription($subscriptionId);

Method: updateSubscriptionPaymentMethod

Updates the payment method from a subscription

function updateSubscriptionPaymentMethod(
        $subscriptionId,
        $request)

Parameters

Parameter Tags Description
subscriptionId Required Subscription id
request Required Request for updating the paymentmethod from a subscription

Example Usage

$subscriptionId = 'subscription_id';
$request = new UpdateSubscriptionPaymentMethodRequest();

$result = $subscriptions->updateSubscriptionPaymentMethod($subscriptionId, $request);

Method: deleteDiscount

Deletes a discount

function deleteDiscount(
        $subscriptionId,
        $discountId)

Parameters

Parameter Tags Description
subscriptionId Required Subscription id
discountId Required Discount Id

Example Usage

$subscriptionId = 'subscription_id';
$discountId = 'discount_id';

$result = $subscriptions->deleteDiscount($subscriptionId, $discountId);

Method: cancelSubscription

Cancels a subscription

function cancelSubscription(
        $subscriptionId,
        $request = null)

Parameters

Parameter Tags Description
subscriptionId Required Subscription id
request Optional Request for cancelling a subscription

Example Usage

$subscriptionId = 'subscription_id';
$request = new CreateCancelSubscriptionRequest();

$result = $subscriptions->cancelSubscription($subscriptionId, $request);

Method: deleteSubscriptionItem

Deletes a subscription item

function deleteSubscriptionItem(
        $subscriptionId,
        $subscriptionItemId)

Parameters

Parameter Tags Description
subscriptionId Required Subscription id
subscriptionItemId Required Subscription item id

Example Usage

$subscriptionId = 'subscription_id';
$subscriptionItemId = 'subscription_item_id';

$result = $subscriptions->deleteSubscriptionItem($subscriptionId, $subscriptionItemId);

Method: deleteUsage

Deletes a usage

function deleteUsage(
        $subscriptionId,
        $itemId,
        $usageId)

Parameters

Parameter Tags Description
subscriptionId Required The subscription id
itemId Required The subscription item id
usageId Required The usage id

Example Usage

$subscriptionId = 'subscription_id';
$itemId = 'item_id';
$usageId = 'usage_id';

$result = $subscriptions->deleteUsage($subscriptionId, $itemId, $usageId);

Method: getUsages

Lists all usages from a subscription item

function getUsages(
        $subscriptionId,
        $itemId,
        $page = null,
        $size = null)

Parameters

Parameter Tags Description
subscriptionId Required The subscription id
itemId Required The subscription item id
page Optional Page number
size Optional Page size

Example Usage

$subscriptionId = 'subscription_id';
$itemId = 'item_id';
$page = 121;
$size = 121;

$result = $subscriptions->getUsages($subscriptionId, $itemId, $page, $size);

Method: updateSubscriptionMetadata

Updates the metadata from a subscription

function updateSubscriptionMetadata(
        $subscriptionId,
        $request)

Parameters

Parameter Tags Description
subscriptionId Required The subscription id
request Required Request for updating the subscrption metadata

Example Usage

$subscriptionId = 'subscription_id';
$request = new UpdateMetadataRequest();

$result = $subscriptions->updateSubscriptionMetadata($subscriptionId, $request);

Method: getSubscriptions

Gets all subscriptions

function getSubscriptions(
        $page = null,
        $size = null,
        $code = null,
        $billingType = null,
        $customerId = null,
        $planId = null,
        $cardId = null,
        $status = null,
        $nextBillingSince = null,
        $nextBillingUntil = null,
        $createdSince = null,
        $createdUntil = null)

Parameters

Parameter Tags Description
page Optional Page number
size Optional Page size
code Optional Filter for subscription's code
billingType Optional Filter for subscription's billing type
customerId Optional Filter for subscription's customer id
planId Optional Filter for subscription's plan id
cardId Optional Filter for subscription's card id
status Optional Filter for subscription's status
nextBillingSince Optional Filter for subscription's next billing date start range
nextBillingUntil Optional Filter for subscription's next billing date end range
createdSince Optional Filter for subscription's creation date start range
createdUntil Optional Filter for subscriptions creation date end range

Example Usage

$page = 121;
$size = 121;
$code = 'code';
$billingType = 'billing_type';
$customerId = 'customer_id';
$planId = 'plan_id';
$cardId = 'card_id';
$status = 'status';
$nextBillingSince = date("D M d, Y G:i");
$nextBillingUntil = date("D M d, Y G:i");
$createdSince = date("D M d, Y G:i");
$createdUntil = date("D M d, Y G:i");

$result = $subscriptions->getSubscriptions($page, $size, $code, $billingType, $customerId, $planId, $cardId, $status, $nextBillingSince, $nextBillingUntil, $createdSince, $createdUntil);

Back to List of Controllers

Class: OrdersController

Get singleton instance

The singleton instance of the OrdersController class can be accessed from the API Client.

$orders = $client->getOrders();

Method: getOrder

Gets an order

function getOrder($orderId)

Parameters

Parameter Tags Description
orderId Required Order id

Example Usage

$orderId = 'order_id';

$result = $orders->getOrder($orderId);

Method: createOrder

Creates a new Order

function createOrder($body)

Parameters

Parameter Tags Description
body Required Request for creating an order

Example Usage

$body = new CreateOrderRequest();

$result = $orders->createOrder($body);

Method: updateOrderMetadata

Updates the metadata from an order

function updateOrderMetadata(
        $orderId,
        $request)

Parameters

Parameter Tags Description
orderId Required The order id
request Required Request for updating the order metadata

Example Usage

$orderId = 'order_id';
$request = new UpdateMetadataRequest();

$result = $orders->updateOrderMetadata($orderId, $request);

Method: getOrders

Gets all orders

function getOrders(
        $page = null,
        $size = null,
        $code = null,
        $status = null,
        $createdSince = null,
        $createdUntil = null,
        $customerId = null)

Parameters

Parameter Tags Description
page Optional Page number
size Optional Page size
code Optional Filter for order's code
status Optional Filter for order's status
createdSince Optional Filter for order's creation date start range
createdUntil Optional Filter for order's creation date end range
customerId Optional Filter for order's customer id

Example Usage

$page = 121;
$size = 121;
$code = 'code';
$status = 'status';
$createdSince = date("D M d, Y G:i");
$createdUntil = date("D M d, Y G:i");
$customerId = 'customer_id';

$result = $orders->getOrders($page, $size, $code, $status, $createdSince, $createdUntil, $customerId);

Back to List of Controllers

Class: TokensController

Get singleton instance

The singleton instance of the TokensController class can be accessed from the API Client.

$tokens = $client->getTokens();

Method: getToken

Tags: Skips Authentication

Gets a token from its id

function getToken(
        $id,
        $publicKey)

Parameters

Parameter Tags Description
id Required Token id
publicKey Required Public key

Example Usage

$id = 'id';
$publicKey = 'public_key';

$result = $tokens->getToken($id, $publicKey);

Method: createToken

Tags: Skips Authentication

TODO: Add a method description

function createToken(
        $publicKey,
        $request)

Parameters

Parameter Tags Description
publicKey Required Public key
request Required Request for creating a token

Example Usage

$publicKey = 'public_key';
$request = new CreateTokenRequest();

$result = $tokens->createToken($publicKey, $request);

Back to List of Controllers

Class: RecipientsController

Get singleton instance

The singleton instance of the RecipientsController class can be accessed from the API Client.

$recipients = $client->getRecipients();

Method: createRecipient

Creates a new recipient

function createRecipient($request)

Parameters

Parameter Tags Description
request Required Recipient data

Example Usage

$request = new CreateRecipientRequest();

$result = $recipients->createRecipient($request);

Method: updateRecipient

Updates a recipient

function updateRecipient(
        $recipientId,
        $request)

Parameters

Parameter Tags Description
recipientId Required Recipient id
request Required Recipient data

Example Usage

$recipientId = 'recipient_id';
$request = new UpdateRecipientRequest();

$result = $recipients->updateRecipient($recipientId, $request);

Method: updateRecipientDefaultBankAccount

Updates the default bank account from a recipient

function updateRecipientDefaultBankAccount(
        $recipientId,
        $request)

Parameters

Parameter Tags Description
recipientId Required Recipient id
request Required Bank account data

Example Usage

$recipientId = 'recipient_id';
$request = new UpdateRecipientBankAccountRequest();

$result = $recipients->updateRecipientDefaultBankAccount($recipientId, $request);

Method: getRecipient

Retrieves recipient information

function getRecipient($recipientId)

Parameters

Parameter Tags Description
recipientId Required Recipiend id

Example Usage

$recipientId = 'recipient_id';

$result = $recipients->getRecipient($recipientId);

Method: getRecipients

Retrieves paginated recipients information

function getRecipients(
        $page = null,
        $size = null)

Parameters

Parameter Tags Description
page Optional Page number
size Optional Page size

Example Usage

$page = 213;
$size = 213;

$result = $recipients->getRecipients($page, $size);

Method: getBalance

Get balance information for a recipient

function getBalance($recipientId)

Parameters

Parameter Tags Description
recipientId Required Recipient id

Example Usage

$recipientId = 'recipient_id';

$result = $recipients->getBalance($recipientId);

Method: createTransfer

Creates a transfer for a recipient

function createTransfer(
        $recipientId,
        $request)

Parameters

Parameter Tags Description
recipientId Required Recipient Id
request Required Transfer data

Example Usage

$recipientId = 'recipient_id';
$request = new CreateTransferRequest();

$result = $recipients->createTransfer($recipientId, $request);

Method: getTransfer

Gets a transfer

function getTransfer(
        $recipientId,
        $transferId)

Parameters

Parameter Tags Description
recipientId Required Recipient id
transferId Required Transfer id

Example Usage

$recipientId = 'recipient_id';
$transferId = 'transfer_id';

$result = $recipients->getTransfer($recipientId, $transferId);

Method: getTransfers

Gets a paginated list of transfers for the recipient

function getTransfers(
        $recipientId,
        $page = null,
        $size = null,
        $status = null,
        $createdSince = null,
        $createdUntil = null)

Parameters

Parameter Tags Description
recipientId Required Recipient id
page Optional Page number
size Optional Page size
status Optional Filter for transfer status
createdSince Optional Filter for start range of transfer creation date
createdUntil Optional Filter for end range of transfer creation date

Example Usage

$recipientId = 'recipient_id';
$page = 213;
$size = 213;
$status = 'status';
$createdSince = date("D M d, Y G:i");
$createdUntil = date("D M d, Y G:i");

$result = $recipients->getTransfers($recipientId, $page, $size, $status, $createdSince, $createdUntil);

Method: createAnticipation

Creates an anticipation

function createAnticipation(
        $recipientId,
        $request)

Parameters

Parameter Tags Description
recipientId Required Recipient id
request Required Anticipation data

Example Usage

$recipientId = 'recipient_id';
$request = new CreateAnticipationRequest();

$result = $recipients->createAnticipation($recipientId, $request);

Method: getAnticipation

Gets an anticipation

function getAnticipation(
        $recipientId,
        $anticipationId)

Parameters

Parameter Tags Description
recipientId Required Recipient id
anticipationId Required Anticipation id

Example Usage

$recipientId = 'recipient_id';
$anticipationId = 'anticipation_id';

$result = $recipients->getAnticipation($recipientId, $anticipationId);

Method: getAnticipationLimits

Gets the anticipation limits for a recipient

function getAnticipationLimits(
        $recipientId,
        $timeframe,
        $paymentDate)

Parameters

Parameter Tags Description
recipientId Required Recipient id
timeframe Required Timeframe
paymentDate Required Anticipation payment date

Example Usage

$recipientId = 'recipient_id';
$timeframe = 'timeframe';
$paymentDate = date("D M d, Y G:i");

$result = $recipients->getAnticipationLimits($recipientId, $timeframe, $paymentDate);

Method: getAnticipations

Retrieves a paginated list of anticipations from a recipient

function getAnticipations(
        $recipientId,
        $page = null,
        $size = null,
        $status = null,
        $timeframe = null,
        $paymentDateSince = null,
        $paymentDateUntil = null,
        $createdSince = null,
        $createdUntil = null)

Parameters

Parameter Tags Description
recipientId Required Recipient id
page Optional Page number
size Optional Page size
status Optional Filter for anticipation status
timeframe Optional Filter for anticipation timeframe
paymentDateSince Optional Filter for start range for anticipation payment date
paymentDateUntil Optional Filter for end range for anticipation payment date
createdSince Optional Filter for start range for anticipation creation date
createdUntil Optional Filter for end range for anticipation creation date

Example Usage

$recipientId = 'recipient_id';
$page = 213;
$size = 213;
$status = 'status';
$timeframe = 'timeframe';
$paymentDateSince = date("D M d, Y G:i");
$paymentDateUntil = date("D M d, Y G:i");
$createdSince = date("D M d, Y G:i");
$createdUntil = date("D M d, Y G:i");

$result = $recipients->getAnticipations($recipientId, $page, $size, $status, $timeframe, $paymentDateSince, $paymentDateUntil, $createdSince, $createdUntil);

Method: updateRecipientMetadata

Updates recipient metadata

function updateRecipientMetadata(
        $recipientId,
        $request)

Parameters

Parameter Tags Description
recipientId Required Recipient id
request Required Metadata

Example Usage

$recipientId = 'recipient_id';
$request = new UpdateMetadataRequest();

$result = $recipients->updateRecipientMetadata($recipientId, $request);

Back to List of Controllers