Cashout

This service could be used to send money to your customers, vendors, etc... via bank account or mobile wallet.

Initiating the cashout request

Initiate a POST by following the below instructions

Request Endpoints

https://cowpay.me/api/v1/merchant/withdrawal
https://staging.cowpay.me/api/v1/merchant/withdrawal
Make sure to send all the listed below headers and keys with the proper values

Headers

HeaderValue
AuthorizationBearer [you token]
Content-Typeapplication/json
Acceptapplication/json

Keys

FieldRequiredTypeDescription
mobile_walletsnoarrayArray of mobile wallets
bank_accountsnoarrayArray of bank accounts
amountyesstringtwo decimal value like: "15.00"
typeyesstringthe type of your withdrawal request must be TRANSFER or REFUND
holder_nameyesstringThe receiver name
mobile_numberyesstringThe receiver wallet mobile number
bank_nameyesstringThe receiver bank account name, the list of available bank names
bank_addressyesstringThe receiver bank account address
numberyesstringThe receiver bank account number
descriptionyesstringcashout request description that reserve the payment name

Request Payload Example

{
    "mobile_wallets": [
        {
            "amount": "10.00",
            "type": "TRANSFER",
            "holder_name": "John Doe",
            "mobile_number": "+201xxxxxxxxx",
            "description": "Chashout request description"
        },
        {
            "amount": "10.00",
            "type": "REFUND",
            "holder_name": "John Doe",
            "mobile_number": "+201xxxxxxxxx",
            "description": "Chashout request description"
        }
    ],
    "bank_accounts": [
        {
            "amount": "10.00",
            "type": "TRANSFER",
            "holder_name": "John Doe",
            "bank_name": "Al Ahli Bank of Kuwait - Egypt",
            "bank_address": "san stefano, alexandria",
            "number": "0123456789",
            "description": "Chashout request description"
        },
        {
            "amount": "10.00",
            "type": "REFUND",
            "holder_name": "John Doe",
            "bank_name": "Al Ahli Bank of Kuwait - Egypt",
            "bank_address": "san stefano, alexandria",
            "number": "0123456789",
            "description": "Chashout request description"
        }
    ]
}

You can send mobile_wallets array only or bank_accounts array only or both of them.

Response when success

{
    "success": true,
    "status_code": 200,
    "status_description": "Withdrawal request created successfully",
    "message": "Withdrawal request created successfully"
}

Response example when failed

{
    "success": false,
    "message": "The given data was invalid.",
    "status_code": 422,
    "status_description": "The given data was invalid.",
    "errors": {
        "errorName": "reason 1",
        "errorName": "reason 2",
        "errorName": "reason 3",
    }
}

Code Examples

POST /api/v1/merchant/withdrawal HTTP/1.1
Host: cowpay.me
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjA4YzExYWRkOTgxYmEyMTAxMjBiNDU4NjU0YzJhNmFkYjdhYjRkNTg0M2UxYTFkMzVlMDM2MDdlNmY2ODMyN2QwZTA1ZmVhY2ExOWExYWIxIn0.eyJhdWQiOiIzIiwianRpIjoiMDhjMTFhZGQ5ODFiYTIxMDEyMGI0NTg2NTRjMmE2YWRiN2FiNGQ1ODQzZTFhMWQzNWUwMzYwN2U2ZjY4MzI3ZDBlMDVmZWFjYTE5YTFhYjEiLCJpYXQiOjE2MDAwODMwNjgsIm5iZiI6MTYwMDA4MzA2OCwiZXhwIjoxNjMxNjE5MDY4LCJzdWIiOiIxNyIsInNjb3BlcyI6W119.f--W72hdY9ABlepGkzFubQx4PNNbxiYJZj8hPfXC2EwsUhPwWYGOL3rTSFnhYTuubJcEXLKnncoXInhBf9Ho2g
Content-Type: application/json

{
  "mobile_wallets": [
      {
          "amount": "10.00",
          "type": "TRANSFER",
          "holder_name": "Testing",
          "mobile_number": "+201xxxxxxxxx",
          "description": "Chashout request description"
      },
      {
          "amount": "10.00",
          "type": "REFUND",
          "holder_name": "Testing",
          "mobile_number": "+201xxxxxxxxx",
          "description": "Chashout request description"
      }
  ],
  "bank_accounts": [
      {
          "amount": "10.00",
          "type": "TRANSFER",
          "holder_name": "Testing",
          "bank_name": "Al Ahli Bank of Kuwait - Egypt",
          "bank_address": "san stefano, alexandria",
          "number": "0123456789",
          "description": "Chashout request description"
      },
      {
          "amount": "10.00",
          "type": "REFUND",
          "holder_name": "Testing",
          "bank_name": "Al Ahli Bank of Kuwait - Egypt",
          "bank_address": "san stefano, alexandria",
          "number": "0123456789",
          "description": "Chashout request description"
      }
  ]
}
let axios = require('axios');

let data = {
  "mobile_wallets": [
      {
          "amount": "10.00",
          "type": "TRANSFER",
          "holder_name": "Testing",
          "mobile_number": "+201xxxxxxxxx",
          "description": "Chashout request description"
      },
      {
          "amount": "10.00",
          "type": "REFUND",
          "holder_name": "Testing",
          "mobile_number": "+201xxxxxxxxx",
          "description": "Chashout request description"
      }
  ],
  "bank_accounts": [
      {
          "amount": "10.00",
          "type": "TRANSFER",
          "holder_name": "Testing",
          "bank_name": "Al Ahli Bank of Kuwait - Egypt",
          "bank_address": "san stefano, alexandria",
          "number": "0123456789",
          "description": "Chashout request description"
      },
      {
          "amount": "10.00",
          "type": "REFUND",
          "holder_name": "Testing",
          "bank_name": "Al Ahli Bank of Kuwait - Egypt",
          "bank_address": "san stefano, alexandria",
          "number": "0123456789",
          "description": "Chashout request description"
      }
  ]
}

let axiosConfig = {
    method: 'post',
    baseURL: 'https://cowpay.me/api/v1/', // or https://staging.cowpay.me/api/v1/,
    url: 'merchant/withdrawal',
    headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjA4YzExYWRkOTgxYmEyMTAxMjBiNDU4NjU0YzJhNmFkYjdhYjRkNTg0M2UxYTFkMzVlMDM2MDdlNmY2ODMyN2QwZTA1ZmVhY2ExOWExYWIxIn0.eyJhdWQiOiIzIiwianRpIjoiMDhjMTFhZGQ5ODFiYTIxMDEyMGI0NTg2NTRjMmE2YWRiN2FiNGQ1ODQzZTFhMWQzNWUwMzYwN2U2ZjY4MzI3ZDBlMDVmZWFjYTE5YTFhYjEiLCJpYXQiOjE2MDAwODMwNjgsIm5iZiI6MTYwMDA4MzA2OCwiZXhwIjoxNjMxNjE5MDY4LCJzdWIiOiIxNyIsInNjb3BlcyI6W119.f--W72hdY9ABlepGkzFubQx4PNNbxiYJZj8hPfXC2EwsUhPwWYGOL3rTSFnhYTuubJcEXLKnncoXInhBf9Ho2g'
    },
    data: data
}

axios(axiosConfig)
    .then(response => {
        console.log(response.data)
    })
    .catch(error => {
        console.log(error.response.data)
    })
$client = new \GuzzleHttp\Client([
    'base_uri' => 'https://cowpay.me/api/v1/', // or https://staging.cowpay.me/api/v1
    'headers' => [
        'Content-Type' => 'application/json',
        'Accept' => 'application/json',
        'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjA4YzExYWRkOTgxYmEyMTAxMjBiNDU4NjU0YzJhNmFkYjdhYjRkNTg0M2UxYTFkMzVlMDM2MDdlNmY2ODMyN2QwZTA1ZmVhY2ExOWExYWIxIn0.eyJhdWQiOiIzIiwianRpIjoiMDhjMTFhZGQ5ODFiYTIxMDEyMGI0NTg2NTRjMmE2YWRiN2FiNGQ1ODQzZTFhMWQzNWUwMzYwN2U2ZjY4MzI3ZDBlMDVmZWFjYTE5YTFhYjEiLCJpYXQiOjE2MDAwODMwNjgsIm5iZiI6MTYwMDA4MzA2OCwiZXhwIjoxNjMxNjE5MDY4LCJzdWIiOiIxNyIsInNjb3BlcyI6W119.f--W72hdY9ABlepGkzFubQx4PNNbxiYJZj8hPfXC2EwsUhPwWYGOL3rTSFnhYTuubJcEXLKnncoXInhBf9Ho2g'
    ]
]);

try {
    $response = $client->request('POST', 'merchant/withdrawal', [
        'json' => [
              "mobile_wallets": [
                  {
                      "amount": "10.00",
                      "type": "TRANSFER",
                      "holder_name": "Testing",
                      "mobile_number": "+201xxxxxxxxx",
                      "description": "Chashout request description"
                  },
                  {
                      "amount": "10.00",
                      "type": "REFUND",
                      "holder_name": "Testing",
                      "mobile_number": "+201xxxxxxxxx",
                      "description": "Chashout request description"
                  }
              ],
              "bank_accounts": [
                  {
                      "amount": "10.00",
                      "type": "TRANSFER",
                      "holder_name": "Testing",
                      "bank_name": "Al Ahli Bank of Kuwait - Egypt",
                      "bank_address": "san stefano, alexandria",
                      "number": "0123456789",
                      "description": "Chashout request description"
                  },
                  {
                      "amount": "10.00",
                      "type": "REFUND",
                      "holder_name": "Testing",
                      "bank_name": "Al Ahli Bank of Kuwait - Egypt",
                      "bank_address": "san stefano, alexandria",
                      "number": "0123456789",
                      "description": "Chashout request description"
                  }
              ]
        ]
    ]);

    $result = json_decode($response->getBody()->getContents(), true);

} catch (\GuzzleHttp\Exception\RequestException $exception) {

    $response = json_decode($exception->getResponse()->getBody()->getContents(), true);

    if ($response['status_code'] == 422) { 

        $errors = $response['errors']; // check invalid data messages

    }
}

Available Bank Names

Bank Name
Arab African International Bank
Arab African International Bank
Arab Banking Corporation
Al Ahli Bank of Kuwait - Egypt
Al Baraka Bank Egypt
Abu Dhabi Islamic Bank Egypt
Arab Investment Bank
Arab Bank
Arab International Bank
Ahly United Bank
Audi Bank
Attijariwafa Bank Egypt S.A.E
Banque Du Caire
Blom Bank Egypt
Bank of Alexandria
Credit Agricole Egypt
Commercial International Bank
Citibank
Egyptian Arab Land Bank
Export Development Bank of Egypt
Egyptian Gulf Bank
Emirates National Bank of Dubai
First Abu Dhabi Bank
Faisal Islamic Bank of Egypt
Housing And Development Bank
HSBC
Industrial Development Bank
Mashreq Bank
Misr Iran Development Bank
Banque Misr
National Bank of Egypt
National Bank of Greece
National Bank Of Kuwait – Egypt
Nasser Social Bank
The Principal Bank for Development and Agri.
Qatar National Bank Alahli
Societe Arabe Internationale De Banque
Suez Canal Bank
The United Bank
Union National Bank