Skip to content

Create a Transfer

To move funds from your YouCanPay account, you must first initiate a transfer. This creates a transfer object if your account has sufficient funds to cover the amount, otherwise you will receive an error.

Endpoint: https://youcanpay.com/api/transfers

Method: POST

Parameters

ParameterTypeDescription
amountrequiredA positive integer in small currency representing how much to transfer.
identifierrequiredThe email or phone number of the YouCanPay account you intend to transfer funds to. Only Moroccan phone numbers (+212) are supported currently.
messageoptionalA message that will be displayed alongside the transfer.

Returns

Returns a transfer object if the request was successful.

Request

bash
$ curl --location -g --request POST 'https://youcanpay.com/api/transfers' \
  --form 'amount="5"' \
  --form 'identifier="0773777722"' \
  --form 'message="Test"' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_TOKEN_eyJpc3...'

Response

json
{
  "data": {
    "id": "6ae1bc33-0752-479d-8f76-d7cdee4aa1b4",
    "display_amount": "MAD 5.00",
    "message": "Hello o/",
    "is_incoming": false,
    "created_at": "2021-12-16 15:17:25",
    "transceiver": {
      "data": {
        "id": "268e1200-b2f2-4ea8-a640-d19b58989891",
        "first_name": "Cesar",
        "last_name": "Walter",
        "phone": "537-631-0416",
        "email": "cesar.walter@example.org",
        "type": 1,
        "type_text": "PERSONAL"
      }
    }
  }
}