This endpoint allows clients to create a new paylist, providing a description and simultaneously adding multiple payments. Upon processing the request, the service will validate each payment item. If everything is in order, it will return a response indicating the paylist has been accepted and will be processed asynchronously. The paylist is just a container of payments and only exists as the collection representation, without status.
IMPORTANT #1: Take into consideration the idempotence_key: this identifies unequivocally the paylist on the system and needs to be unique for each one. The idea behind this is to not allow repeated paylist creation on retries due to network issues of any kind. The field has to be 32 characters long; we recommend to use MD5 hashing algorithm since it produces the required string size.
IMPORTANT #2: The payment process will generate an idempotency key internally for it. The fields taken into account for this are: amount, email and description. If you have repetitive payments for the same amount and purpose, consider adding an extra text into the description to indicate the motive in a more precise way (i.e. dates, goals, etc).
curl -X POST 'https://api.demo.getontop.com/payment-agent/paylists' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer xxxxxxxxxxxxxxxxxx' \
--data-raw '{
"description":"Payments september",
"idempotence_key":"anuniquekey123",
"payments":[
{
"description":"Payment 1",
"amount":10,
"worker_email":"[email protected]"
},
{
"description":"Payment 2",
"amount":30,
"worker_email":"[email protected]"
}
],
"client_id":100
}'
{
"id":23,
"description":"Payments september",
"client_id":100,
"idempotence_key":"anuniquekey123",
"creation_date":"2023-09-29T14:01:37.151862380Z"
}