PHP code example of xplicit-dev / mamopay

1. Go to this page and download the library: Download xplicit-dev/mamopay 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/ */

    

xplicit-dev / mamopay example snippets


use MamoPay\Api\MamoClient;


$client = (new MamoClient('API_KEY'));

$client = (new MamoClient('API_KEY',true));

// $client->class()->function() to access the API

//Example

$client->links()->get($linkId);

use MamoPay\Api\MamoClient;

$client = (new MamoClient('API_KEY'));
$params = ['card_id' => $card_id, 'amount' => $amount, 'currency' => $currency];
$response = $client->httpClient->sendRequest('end_point',$params,HttpClient::METHOD_POST);

$params = ['is_widget' => true , 'save_card'=>true];

$response = $client->links()->create($title,$amount,$returnUrl,$params);

$id = $response->id;

$payment_url = $response->payment_url;

$client->links()->all();

$client->links()->update($linkID,$params);

$client->links()->delete($linkID);

$client->links()->get($linkID);

$charge = $client->transaction()->create($card_id,$amount);

$chargeID = $charge->id;

$client->transaction()->get($chargeID);

$client->transaction()->all();

$client->transaction()->refund($chargeId,$amount);

$client->subscription()->all($subscriptionId);

$client->subscription()->get($subscriptionId);

$client->subscription()->unSubscribe($subscriptionId,$subscriberId);

$client->subscription()->cancelRecurring($subscriptionId);

$client->payout()->all();

$client->payout()->issue($account_no, $amount, $first_name, $last_name = '', $reason = '', $transfer_method = 'BANK_ACCOUNT');


use MamoPay\Api\Objects\Disbursement;

$client = (new MamoClient());

$disbursement[0] = (new Disbursement())->set([
'account' => 'AE080200000123223333121',
'amount' => 10,
'first_name_or_business_name' => 'John',
'last_name' => 'Doe',
]);

$disbursement[1] = (new Disbursement())->set([
'account' => 'AE080200000123223333121',
'amount' => 20.5,
'first_name_or_business_name' => 'John',
'last_name' => 'Doe',
'reason' => 'refund for lorem ipsum',
]);

$disbursements = $client->payout()->issueMultiple($disbursement);

$client->webhook()->create($uri,$events,'authentication header');

use MamoPay\Api\Events\WebhookEvent;



$response = $client->webhook()->create("http://example.com",WebhookEvent::ALL_EVENT_TYPES,'authentication header');

$response = $client->webhook()->create("http://example.com",[WebhookEvent::CHARGE_CARD_VERIFIED,WebhookEvent::CHARGE_SUCCEEDED]);

$webhookId = $response->id;

$client->webhook()->all();

$client->webhook()->update($webhookId,"http://example.com",WebhookEvent::ALL_EVENT_TYPES,'authentication header');

$client->webhook()->delete($webhookId);