PHP code example of eversend / eversend-php-sdk

1. Go to this page and download the library: Download eversend/eversend-php-sdk 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/ */

    

eversend / eversend-php-sdk example snippets


use Eversend\Eversend

$eversendClient = new Eversend(
    clientId= 'clientId',
    clientSecret= 'clientSecret',
    version=1
);

$wallets = eversendClient.wallets().list();

$usdWallet = eversendClient.wallets().get(walletId: "USD");

$transactions = eversendClient.transactions().list(page: 1, limit: 10);

$transaction = eversendClient.transactions().get(
    transactionId: "EVS12345678"
);

$quotation = eversendClient.exchange().createQuotation(
    from: "USD", to: "UGX", amount: 10.0
);

$exchange = eversendClient.exchange().createExchange(
    token: "dhhsggajjshhdhdhd",
    transactionRef: "EVS-12345678", // optional field
);

$beneficiaries = eversendClient.beneficiaries.list(
    page: 1,
    limit: 10,
);

$beneficiaries = eversendClient.beneficiaries().list(
    search: "Okello",
    page: 1,
    limit: 10,
);

$beneficiary = eversendClient.beneficiaries().get(
    beneficiaryId: 100
);

$beneficiary = eversendClient.beneficiaries.create(
    firstName: "John",
    lastName: "Okello",
    country: "UG", // Alpha-2 country code
    phoneNumber: "+256712345678", // Should be in international format
    bankAccountName: "John Okello",
    bankAccountNumber: "12345678",
    bankName: "Stanbic Bank",
    bankCode: 1234 // You can get the bank code from payouts.getDeliveryBanks()
);

$beneficiary = eversendClient.beneficiaries.update(
    beneficiaryId: 100,
    firstName: "John",
    lastName: "Okello",
    country: "UG", // Alpha-2 country code
    phoneNumber: "+256712345678", // Should be in international format
    bankAccountName: "John Okello",
    bankAccountNumber: "12345678",
    bankName: "Stanbic Bank",
    bankCode: 1234 // You can get the bank code from payouts.getDeliveryBanks()
);

$beneficiary = eversendClient.beneficiaries.delete(
    beneficiaryId: 100
);

$collectionFees = eversendClient.collections().getFees(
    amount: 1000,
    currency: "KES",
    method: "momo"
);

$collectionOTP = eversendClient.collections().getOTP(
    phone: "+256712345678"
);

eversendClient.collections().initiateMomo(
    phone: "+256712345678",
    amount: 1000,
    country: "UG",
    currency: "UGX",
    pin: 123456, // From phone number passed in Get Collection OTP
    pinId: "dg524fhsgfde", // From Get Collection OTP
    transactionRef: "EVS-12345678", // Optional transaction ref generated by you
    customer: { name: "John Okello" } // Optional customer object with your metadata
);

$quotation = eversendClient.payouts.getQuotation(
    amount: 100,
    amountType: "SOURCE", // amountType can be SOURCE or DESTINATION
    sourceWallet: "USD",
    destinationCountry: "KE",
    destinationCurrency: "KES"
);

$payout = eversendClient.payouts.initiate(
    beneficiaryId: 100,
    quotationToken: "token",
    transactionRef: "EVS-12345678" // Optional transaction ref generated by you
);

$payout = eversendClient.payouts.initiate({
    firstName: "John",
    lastName: "Okello",
    country: "UG", // Alpha-2 country code
    phoneNumber: "+256712345678", // Should be in international format
    bankAccountName: "John Okello",
    bankAccountNumber: "12345678",
    bankName: "Stanbic Bank",
    bankCode: 1234, // You can get the bank code from payouts.getDeliveryBanks()
    quotationToken: "token",
    transactionRef: "EVS-12345678" // Optional transaction ref generated by you
});

$countries = eversendClient.payouts.countries()

$banks = eversendClient.payouts.banks(
    country: "UG"
);