Payouts
We have seen how to accept payments via card, store and bank, now we will see how to send payments to third parties (customers or suppliers).
Note: This feature only allows bank account numbers from Mexico.
Create a payment
To create a payment you must make a request indicating the bank account, the number and amount.
For this example we will send a $ 500.00 payment to a bank account.
If the request is correct and there are enough funds in the account, then a response with a transaction object will be returned.
Response:
{
"amount":500.00,
"authorization":null,
"method":"bank_account",
"operation_type":"out",
"transaction_type":"payout",
"status":"in_progress",
"currency":"MXN",
"id":"trw6owxszajwtph5swry",
"creation_date":"2014-02-14T15:43:49-06:00",
"description":"pago prueba",
"error_message":null,
"order_id":null,
"bank_account":{
"clabe":"012XXXXXXXXXX24616",
"bank_code":"012",
"bank_name":"BANCOMER",
"alias":null,
"holder_name":"Juan Tapia Trejo",
"creation_date":"2014-02-14T15:43:49-06:00"
}
}
Management of payment status
The payments happen asynchronously, so at the moment of creating the payment the transaction will have a in_progress
status. If the payment was created before 18:00 hrs the payment will be scheduled to run the next business day, if not it will be scheduled for the second business day.
When the payment is sent to the bank the following may occur:
- You receive a
payout.succeeded
webhook which means that the payment was accepted by the bank and the funds are on the destination account. - The transfer fails and you receive a
payout.failed
webhook which means that the bank rejected the payment because maybe the destination account does not exist.
Sandbox:The payment is simulated five minutes after being created, so you can receive a payment notification to your system via a Webhook in your test environment.
Errors
Wrong CLABE account numbers
You will get the following error if the CLABE account number is wrong at the moment of requesting to send the payment. This can be because the bank code or the verifying digit is invalid.
Response:
{
"category":"request",
"description":"The CLABE number is invalid",
"http_code":422,
"error_code":1003,
"request_id":"b6686b9b-65ed-49b6-8326-550fb3c7522a"
}
Not enough funds
If the origin account doesn’t have enough funds, the transaction will not be created and you will get the following error.
Response:
{
"category":"request",
"description":"There are not enough funds in the openpay account",
"http_code":412,
"error_code":4001,
"request_id":"04a71fcd-72bb-4091-8fc9-993a7c9853b7"
}
Notes:
- Implement Notifications to know the status of payments in real time