Skip to content
ESENGo to the Portal

Per-integration features

Refunds and WhatsApp notices: what they allow, how they are enabled for your integration and what you choose.

Chytapay enables some features per integration. Here are refunds and WhatsApp notices. WhatsApp notices come enabled; refunds are requested.

How they are enabled

Refunds are enabled by Chytapay, each mode separately, on request. Ask support about the cost at [email protected]. WhatsApp notices come enabled on every integration, with both messages: you do not need to ask for them. Chytapay can turn them off or limit them for an integration.

Once enabled, you choose what you use in the Portal, under Configuración (Settings): which automatic Devoluciones (Refunds) run and the Avisos por WhatsApp (WhatsApp notices). They are configured in Production. The Portal has no button to refund a charge: you do that through the API, or Chytapay support does it. Anything Chytapay has not enabled shows as locked, with a button to ask for it.

Refunds

We send the money back to the account it came from, from the merchant's main account. Each mode is enabled separately:

Mode What it does
By API You refund a charge, in full or in part, with the refunds endpoint.
Automatic for excess If the payer transfers too much, we return the difference (from $1).
Automatic for short payments If the payer transfers less than the total, we return the whole payment. A payment.unmatched arrives with reason partial_not_accepted.
Automatic for unassigned If a transfer matches no charge, we return it.

Refund by API

On top of Chytapay enabling refunds for your integration, each merchant must authorize them through the API. Ask [email protected] or WhatsApp at +54 9 351 543 0077, with the merchant's written authorization. Until then the endpoint returns 403 RefundsNotConsentedError. Payments from the last 10 days can be refunded. With the merchant's id_token:

cURL

curl -X POST https://integration-api.test.chytapay.com.ar/payment-request/order-1001/refunds \
  -H "Authorization: Bearer $ID_TOKEN" \
  -H "Idempotency-Key: refund-order-1001-a" \
  -H "Content-Type: application/json" \
  -d '{ "amount": 5000, "reason": "Out of stock" }'

Response

{
  "refundId": "00000000-0000-0000-0000-000000000000",
  "paymentRequest": { "referenceId": "order-1001", "state": "total_payment" },
  "origin": "api",
  "trigger": null,
  "status": "pending",
  "requestedAmount": 5000,
  "refundedAmount": 0,
  "reason": "Out of stock",
  "items": [{ "amount": 5000, "status": "pending" }]
}

It returns 202: the refund is asynchronous and the result arrives by webhook.

Field Required? What it is
Idempotency-Key (header) Yes 1 to 255 characters. A retry with the same key and body returns the same refund.
amount No Pesos, greater than 0, up to 2 decimals. Without it, everything left from the payments of the last 10 days is refunded. With it, that part, newest payment first.
reason No Up to 500 characters.

You can make partial refunds one after another up to the total, one at a time. To look up a refund, GET /refunds/{refundId} (it includes the automatic ones).

status is pending, processing, succeeded, failed or partially_failed. A refunded charge moves to refunded or partially_refunded.

See the refund errors
Status Error When
400 IdempotencyKeyRequiredError The Idempotency-Key header is missing or longer than 255 characters.
403 RefundsNotEnabledError Refunds are not enabled for your integration.
403 ApiRefundsNotAllowedError Refunds through the API are not enabled.
403 RefundsNotConsentedError The merchant's authorization to refund through the API is missing. Ask Chytapay for it.
404 PaymentRequestNotFoundError No charge with that referenceId in your integration.
409 RefundAlreadyRefundedError, RefundInProgressError Already refunded, or a refund is in progress.
409 RefundNoPaymentsError, RefundPaymentTooOldError There are no payments to refund, or none in the last 10 days.
409 RefundPaymentNotSettledError, RefundPaymentWithoutOriginError A payment has not reached the main account yet, or has no origin account.
409 RefundInvoicedPaymentRequestError The charge was invoiced: only support can refund it.
409 RefundInsufficientBalanceError The merchant's main account does not have enough balance.
409 IdempotencyRequestInProgressError Another request with the same key is still in progress.
422 RefundAmountExceedsRefundableError The amount exceeds what is left to refund.
422 IdempotencyKeyReusedError The key was already used with another body.
503 PrincipalBalanceUnavailableError We could not check the balance. Nothing was created: retry with the same key.

Automatic refunds

Chytapay enables the modes and you choose which ones run, under Configuración, Devoluciones. They do not need the merchant's authorization: that is only for refunds through the API. A newly enabled automatic mode starts on, unless you already made a choice about it. Turning it on starts returning money: the transfers that meet the condition are returned on their own.

If the merchant has more than one active integration and the transfer was not assigned to a charge, there is no automatic refund.

Refund events

refund.succeeded (all the money went back to the payer) and refund.failed (at least part of it could not be returned) are off by default. Enable them under Webhooks, Eventos (Events) tab. They go to the same URLs as the rest, with the same signature.

Example of refund.succeeded:

JSON
{
  "event": "refund.succeeded",
  "livemode": false,
  "refundId": "00000000-0000-0000-0000-000000000000",
  "paymentRequest": { "referenceId": "order-1001", "state": "partially_refunded" },
  "origin": "api",
  "trigger": null,
  "status": "succeeded",
  "requestedAmount": 5000,
  "refundedAmount": 5000,
  "reason": "Out of stock",
  "items": [{ "amount": 5000, "status": "succeeded" }],
  "merchantUserId": "00000000-0000-4000-8000-000000000001",
  "merchantTaxId": "30712345671",
  "merchantName": "Test Merchant"
}
  • origin says who asked for it: api, merchant, chyta (support) or auto.
  • trigger only travels with auto: unmatched, partial or excess.
  • paymentRequest is null in the automatic refund of a transfer that was not assigned to any charge. It sits inside an object so a handler that does not look at event does not act on the charge.
  • reason is null in the refunds support asks for.
  • tenantKey only travels if the merchant is in a location.

WhatsApp notices

They are Chytapay messages to the payer. There are two, and each can be enabled or limited separately:

Message What it sends
Charge notice The payment link by WhatsApp when the charge is created, and its reminders. Only goes out if the charge has an amount and customer.phoneNumber.
Payment confirmation Tells the payer when the payment is credited.

What starts on

By default the payment confirmation goes out. The charge notice starts off: you turn it on under Configuración, Avisos por WhatsApp, and only then does it apply.

What you choose there applies when the charge says nothing. What the charge sends wins:

  • An omitted sendWhatsappNotification uses your choice. true or false on the charge overrides it.
  • An omitted sendWhatsappPaymentConfirmation keeps the behavior of each reconciliation mode. See payment confirmation.

If a charge asks for a message Chytapay turned off or limited for your integration, the API returns 403 (WhatsappNotEnabledError, WhatsappNotificationNotAllowedError or WhatsappPaymentConfirmationNotAllowedError). The daily message limit still applies.