PHP code example of oscar-team / payaut-php

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

    

oscar-team / payaut-php example snippets




$client = new \OscarTeam\Payaut\PayautApi(token: 'token', environment: 'test');

$client->accountHolders()->list(queryParams: ['_fragments' => 'extacc', '_pageNumber' => '1', '_sort' => 'asc'])->json();

// Check Official docs for parameters
$requestData = [
    "displayName" => "J. Doe",
    "legalEntity" => [
        "legalName" => "John Doe",
        "firstName" => "John",
        "lastName" => "Doe",
        "legalForm" => "individual"
    ]
];
$client->accountHolders()->create($requestData)->json();
$client->accountHolders()->get(code: 'accountHolderCode', queryParams: ['_fragemnts' => 'extacc'])->json();
$client->accountHolders()->update($requestData)->json();
$client->accountHolders()->delete(code: 'accountHolderCode')->json();
$client->accountHolders()->accounts()->getAccounts(
        accountHolderCode: 'accountHolderCode',
        queryParams: [],
)->json();
$client->accountHolders()->accounts()->getAccount(
        accountHolderCode: 'accountHolderCode',
        virtualAccountCode: 'virtualAccountCode',
        queryParams: [],
)->json();
$client->accountHolders()->externalAccounts()->list(
        accountHolderCode: 'accountHolderCode',
        queryParams: [],
)->json();
$client->accountHolders()->externalAccounts()->create(
        accountHolderCode: 'accountHolderCode',
        requestData: [] //Check official documentation for requestData payload
)->json();
$client->accountHolders()->externalAccounts()->get(
        accountHolderCode: 'accountHolderCode',
        externalAccountCode: 'externalAccountCode',
        queryParams: []
)->json();
$client->accountHolders()->externalAccounts()->update(
        accountHolderCode: 'accountHolderCode',
        externalAccountCode: 'externalAccountCode',
        requestData: [] //Check official documentation for requestData payload
)->json();
$client->accountHolders()->externalAccounts()->selectActiveExternalAccount(
        accountHolderCode: 'accountHolderCode',
        externalAccountCode: 'externalAccountCode'
)->json();
$client->accountHolders()->hostedOnboarding()->generateUrl(
        accountHolderCode: 'accountHolderCode',
        queryParams: []
)->body();

$client->split()->list(queryParams: [])->json();

$requestData = [
    "extRef" => "order123",
    "totalAmount" => 7000,
    "description" => "order 123",
    "items" => [
        [
            "type" => "GROUP",
            "extRef" => "order123split",
            "amount" => "7000,",
            "accountCode" => "FD5CKXPzDbi5xmwhrx71GmefFJNsztJjC48",
            "description" => "order 123 group",
            "items" => [
                [
                "type" => "GROUP",
                "extRef" => "order123splitgroup",
                "amount" => "7000,",
                "description" => "order 123 group",
                "items" => [
                        [
                            "type" => "ITEM",
                            "label" => "COMMISSION",
                            "extRef" => "order123commission",
                            "amount" => "1200,",
                            "description" => "commission"
                        ],
                        [
                            "type" => "ITEM",
                            "label" => "PRODUCT_ITEM",
                            "extRef" => "order123selleramount",
                            "amount" => "7000,",
                            "description" => "seller amount"
                        ]
                   ]
                ]
            ]
        ],
    ],
    "pspExtRef" => "PSP reference",
    "currency" => "EUR",
    "paymentProcessor" => "ADYEN",
    "paymentMethod" => "iDEAL"
];
$client->split()->create(requestData: $requestData)->json();
$client->split()->get(code: 'splitCode')->json();
$client->split()->update($requestData)->json();
$client->split()->cancel(code: 'splitPaymentCode')->json();
$client->split()->refunds()->list(queryParams: [])->json();
$client->split()->refunds()->create(requestData: [])->json();
$client->split()->refunds()->get(code: 'splitRefundCode')->json();

$client->manageFunds()->getBalance(code: 'accountCode')->json();
$client->manageFunds()->listDivisionInformation()->json();
$requestData = [
    "fromAccountCode" => "FD5CM7GKttVTf7Gt7KcTVKU37fx7StTxvcc",
    "toAccountCode"=> "FD5CMdGdJD7gUGVfTtDUU77vYtUSaa37tJ7",
    "amount" => 1000,
    "currency" => "EUR",
    "idempotencyKey" => "f4754d35-7eaf-4338-a5ac-9d61bb1a2ff7",
    "type" => "INVOICE",
    "description" => "string"
];
$client->manageFunds()->transferBalance(requestData: $requestData)->json();

$client->payouts()->list(version: 'v1', queryParams: [])->json();
$client->payouts()->get(code: 'code')->json();
$client->payouts()->config()->getAccountHolderConfiguration(virtualAccountCode: 'virtualAccountCode')->json();
//Check official documentation for requestData payload
$client->payouts()->config()->updateAccountHolderConfiguration(virtualAccountCode: 'virtualAccountCode', requestData: [])->json();
$client->payouts()->config()->deleteAccountHolderConfiguration(virtualAccountCode: 'virtualAccountCode')->json();
$client->payouts()->config()->getDivisionConfiguration()->json();
//Check official documentation for requestData payload
$client->payouts()->config()->updateDivisionConfiguration(requestData: [])->json();
$client->payouts()->config()->getDefaultConfiguration()->json();
//Check official documentation for requestData payload
$client->payouts()->config()->updateDefaultConfiguration(requestData: [])->json();
$requestData = [
    "accountCode" => "FD5CM7GKttVTf7Gt7KcTVKU37fx7StTxvcc",
    "amount" => 1000,
    "sourceCurrency" => "EUR",
    "targetCurrency" => "EUR",
    "description" => "This is a test payout request",
    "externalAccountCode" => "FD5CMGdfT7g56S1vx4Rq9vDEmN52G8NrWFi",
    "processAt" => "2022-02-03T13:12:53.10032+01:00"
];
$client->payouts()->create(requestData: $requestData)->json();
$client->payouts()->delete(code: 'payoutRequestCde')->json();

$client->transactions()->get(queryParams: [])->json();

$client->reporting()->getReport(report: 'string')->json();
$requestData = [
    "id" => "985bb876-657e-4fea-82a7-b1efc0bdc318",
    "report" => "marketplace-sellers",
    "status" => "SCHEDULED",
    "url" => "string",
    "createdAt" => "2022-04-09T09:32:48.257538",
    "account" => [
        "id" => "FD5CKXPze3o29SQD7MwYDDCX8oKKjN6h4eF",
        "name" => "John Doe",
        "type" => "seller"
    ]
];
$client->reporting()->getReportForSpecificAccount(report: 'string', requestData: $requestData)->json();

$requestData = [
    "url" => "https://webhook.site/38b93d22-0621-4984-b9b5-35f834afad4e",
    "isActivated": true,
    "type": "WEBHOOK_KYC_UPDATE"
];
$client->webhookConfiguration()->create(requestData: $requestData)->json();
$client->webhookConfiguration()->update(
    configurationId: 'configurationId',
    requestData: $requestData)->json();
$client->webhookConfiguration()->get(configurationId: 'configurationId')->json();
$client->webhookConfiguration()->list()->json();
bash
composer