PHP code example of mundipagg / mundiapi

1. Go to this page and download the library: Download mundipagg/mundiapi library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mundipagg / mundiapi example snippets



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

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

$subscriptions = $client->getSubscriptions();

function createDiscount(
        $subscriptionId,
        $body,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$body = new SubscriptionsDiscountsRequest();
$idempotencyKey = 'idempotency-key';

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


function getSubscriptionItem(
        $subscriptionId,
        $itemId)

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

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


function updateSubscriptionItem(
        $subscriptionId,
        $itemId,
        $body,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$itemId = 'item_id';
$body = new SubscriptionsItemsRequest();
$idempotencyKey = 'idempotency-key';

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


function deleteUsage(
        $subscriptionId,
        $itemId,
        $usageId,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$itemId = 'item_id';
$usageId = 'usage_id';
$idempotencyKey = 'idempotency-key';

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


function cancelSubscription(
        $subscriptionId,
        $idempotencyKey = null,
        $body = null)

$subscriptionId = 'subscription_id';
$idempotencyKey = 'idempotency-key';
$body = new SubscriptionsRequest();

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


function getSubscription($subscriptionId)

$subscriptionId = 'subscription_id';

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


function deleteIncrement(
        $subscriptionId,
        $incrementId,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$incrementId = 'increment_id';
$idempotencyKey = 'idempotency-key';

$result = $subscriptions->deleteIncrement($subscriptionId, $incrementId, $idempotencyKey);


function getIncrementById(
        $subscriptionId,
        $incrementId)

$subscriptionId = 'subscription_id';
$incrementId = 'increment_id';

$result = $subscriptions->getIncrementById($subscriptionId, $incrementId);


function getSubscriptionCycleById(
        $subscriptionId,
        $cycleId)

$subscriptionId = 'subscription_id';
$cycleId = 'cycleId';

$result = $subscriptions->getSubscriptionCycleById($subscriptionId, $cycleId);


function updateSubscriptionStartAt(
        $subscriptionId,
        $body,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$body = new SubscriptionsStartAtRequest();
$idempotencyKey = 'idempotency-key';

$result = $subscriptions->updateSubscriptionStartAt($subscriptionId, $body, $idempotencyKey);


function updateSubscriptionPaymentMethod(
        $subscriptionId,
        $body,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$body = new SubscriptionsPaymentMethodRequest();
$idempotencyKey = 'idempotency-key';

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


function updateCurrentCycleStatus(
        $subscriptionId,
        $body,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$body = new UpdateCurrentCycleStatusRequest();
$idempotencyKey = 'idempotency-key';

$subscriptions->updateCurrentCycleStatus($subscriptionId, $body, $idempotencyKey);


function createSubscription(
        $body,
        $idempotencyKey = null)

$body = new SubscriptionsRequest1();
$idempotencyKey = 'idempotency-key';

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


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)

$page = 83;
$size = 83;
$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);


function getUsagesDetails(
        $subscriptionId,
        $cycleId = null,
        $size = null,
        $page = null,
        $itemId = null,
        $group = null)

$subscriptionId = 'subscription_id';
$cycleId = 'cycle_id';
$size = 83;
$page = 83;
$itemId = 'item_id';
$group = 'group';

$result = $subscriptions->getUsagesDetails($subscriptionId, $cycleId, $size, $page, $itemId, $group);


function renewSubscription(
        $subscriptionId,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$idempotencyKey = 'idempotency-key';

$result = $subscriptions->renewSubscription($subscriptionId, $idempotencyKey);


function getSubscriptionCycles(
        $subscriptionId,
        $page,
        $size)

$subscriptionId = 'subscription_id';
$page = 'page';
$size = 'size';

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


function createAnUsage(
        $subscriptionId,
        $itemId,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$itemId = 'item_id';
$idempotencyKey = 'idempotency-key';

$result = $subscriptions->createAnUsage($subscriptionId, $itemId, $idempotencyKey);


function getUsages(
        $subscriptionId,
        $itemId,
        $page = null,
        $size = null,
        $code = null,
        $group = null,
        $usedSince = null,
        $usedUntil = null)

$subscriptionId = 'subscription_id';
$itemId = 'item_id';
$page = 83;
$size = 83;
$code = 'code';
$group = 'group';
$usedSince = date("D M d, Y G:i");
$usedUntil = date("D M d, Y G:i");

$result = $subscriptions->getUsages($subscriptionId, $itemId, $page, $size, $code, $group, $usedSince, $usedUntil);


function deleteDiscount(
        $subscriptionId,
        $discountId,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$discountId = 'discount_id';
$idempotencyKey = 'idempotency-key';

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


function getIncrements(
        $subscriptionId,
        $page = null,
        $size = null)

$subscriptionId = 'subscription_id';
$page = 83;
$size = 83;

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


function createSubscriptionItem(
        $subscriptionId,
        $body,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$body = new SubscriptionsItemsRequest1();
$idempotencyKey = 'idempotency-key';

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


function getSubscriptionItems(
        $subscriptionId,
        $page = null,
        $size = null,
        $name = null,
        $code = null,
        $status = null,
        $description = null,
        $createdSince = null,
        $createdUntil = null)

$subscriptionId = 'subscription_id';
$page = 83;
$size = 83;
$name = 'name';
$code = 'code';
$status = 'status';
$description = 'description';
$createdSince = 'created_since';
$createdUntil = 'created_until';

$result = $subscriptions->getSubscriptionItems($subscriptionId, $page, $size, $name, $code, $status, $description, $createdSince, $createdUntil);


function updateSubscriptionBillingDate(
        $subscriptionId,
        $body,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$body = new SubscriptionsBillingDateRequest();
$idempotencyKey = 'idempotency-key';

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


function updateLatestPeriodEndAt(
        $subscriptionId,
        $body,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$body = new SubscriptionsPeriodsLatestEndAtRequest();
$idempotencyKey = 'idempotency-key';

$result = $subscriptions->updateLatestPeriodEndAt($subscriptionId, $body, $idempotencyKey);


function updateSubscriptionAffiliationId(
        $subscriptionId,
        $body,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$body = new SubscriptionsGatewayAffiliationIdRequest();
$idempotencyKey = 'idempotency-key';

$result = $subscriptions->updateSubscriptionAffiliationId($subscriptionId, $body, $idempotencyKey);


function deleteSubscriptionItem(
        $subscriptionId,
        $subscriptionItemId,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$subscriptionItemId = 'subscription_item_id';
$idempotencyKey = 'idempotency-key';

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


function updateSubscriptionCard(
        $subscriptionId,
        $body,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$body = new SubscriptionsCardRequest();
$idempotencyKey = 'idempotency-key';

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


function updateSubscriptionMetadata(
        $subscriptionId,
        $body,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$body = new SubscriptionsMetadataRequest();
$idempotencyKey = 'idempotency-key';

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


function updateSubscriptionDueDays(
        $subscriptionId,
        $body,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$body = new UpdateSubscriptionDueDaysRequest();
$idempotencyKey = 'idempotency-key';

$result = $subscriptions->updateSubscriptionDueDays($subscriptionId, $body, $idempotencyKey);


function getDiscounts(
        $subscriptionId,
        $page,
        $size)

$subscriptionId = 'subscription_id';
$page = 83;
$size = 83;

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


function createIncrement(
        $subscriptionId,
        $body,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$body = new SubscriptionsIncrementsRequest();
$idempotencyKey = 'idempotency-key';

$result = $subscriptions->createIncrement($subscriptionId, $body, $idempotencyKey);


function getDiscountById(
        $subscriptionId,
        $discountId)

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

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


function updateSubscriptionMiniumPrice(
        $subscriptionId,
        $body,
        $idempotencyKey = null)

$subscriptionId = 'subscription_id';
$body = new SubscriptionsMinimumPriceRequest();
$idempotencyKey = 'idempotency-key';

$result = $subscriptions->updateSubscriptionMiniumPrice($subscriptionId, $body, $idempotencyKey);


function getUsageReport(
        $subscriptionId,
        $periodId)

$subscriptionId = 'subscription_id';
$periodId = 'period_id';

$result = $subscriptions->getUsageReport($subscriptionId, $periodId);


function updateSplitSubscription(
        $id,
        $body)

$id = 'id';
$body = new UpdateSubscriptionSplitRequest();

$result = $subscriptions->updateSplitSubscription($id, $body);


$orders = $client->getOrders();

function updateOrderStatus(
        $id,
        $body,
        $idempotencyKey = null)

$id = 'id';
$body = new UpdateOrderStatusRequest();
$idempotencyKey = 'idempotency-key';

$result = $orders->updateOrderStatus($id, $body, $idempotencyKey);


function deleteAllOrderItems(
        $orderId,
        $idempotencyKey = null)

$orderId = 'orderId';
$idempotencyKey = 'idempotency-key';

$result = $orders->deleteAllOrderItems($orderId, $idempotencyKey);


function createOrderItem(
        $orderId,
        $body,
        $idempotencyKey = null)

$orderId = 'orderId';
$body = new OrdersItemsRequest();
$idempotencyKey = 'idempotency-key';

$result = $orders->createOrderItem($orderId, $body, $idempotencyKey);


function updateOrderMetadata(
        $orderId,
        $body,
        $idempotencyKey = null)

$orderId = 'order_id';
$body = new OrdersMetadataRequest();
$idempotencyKey = 'idempotency-key';

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


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

$page = 175;
$size = 175;
$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);


function createOrder(
        $body,
        $idempotencyKey = null)

$body = new OrdersRequest();
$idempotencyKey = 'idempotency-key';

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


function deleteOrderItem(
        $orderId,
        $itemId,
        $idempotencyKey = null)

$orderId = 'orderId';
$itemId = 'itemId';
$idempotencyKey = 'idempotency-key';

$result = $orders->deleteOrderItem($orderId, $itemId, $idempotencyKey);


function getOrderItem(
        $orderId,
        $itemId)

$orderId = 'orderId';
$itemId = 'itemId';

$result = $orders->getOrderItem($orderId, $itemId);


function updateOrderItem(
        $orderId,
        $itemId,
        $body,
        $idempotencyKey = null)

$orderId = 'orderId';
$itemId = 'itemId';
$body = new OrdersItemsRequest1();
$idempotencyKey = 'idempotency-key';

$result = $orders->updateOrderItem($orderId, $itemId, $body, $idempotencyKey);


function getOrder($orderId)

$orderId = 'order_id';

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


$plans = $client->getPlans();

function updatePlanItem(
        $planId,
        $planItemId,
        $body,
        $idempotencyKey = null)

$planId = 'plan_id';
$planItemId = 'plan_item_id';
$body = new PlansItemsRequest();
$idempotencyKey = 'idempotency-key';

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

autoload.php