Skip to content

Create a Refund. Fund will be refund to the credit card where it was originally charged.

POST https://api.leapa.co/v2/refunds

This endpoint needs your API key

Send it as a bearer token in the Authorization header. A request without one is answered with 401. See Authentication for where to find your key and how to keep it secret.

Request

curl -X POST "https://api.leapa.co/v2/refunds" \
  -H "Authorization: Bearer $LEAPA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 45000,
    "description": "Room 204, two nights",
    "reason": "duplicate",
    "charge_id": "chg_5a90bc71de",
    "invoice_id": "inv_7c1f9a2b48"
  }'

Response

Created

{
  "id": "obj_5f21c8a40b",
  "object": "string",
  "amount": 45000,
  "currency": "BIF",
  "description": "Room 204, two nights",
  "reason": "duplicate",
  "status": "succeeded",
  "receivingAccountId": "00012345678901",
  "charge_id": "chg_5a90bc71de",
  "created_date": 0,
  "source_id": "src_0e7b3c95af",
  "failure_reason": "lost_or_stolen_card",
  "invoice_id": "inv_7c1f9a2b48",
  "live": false,
  "modified_date": 0,
  "processing_id": "string"
}

Request body

application/json

Required. Send it as JSON.

  • amountinteger<int64>required

    Amount to be refunded. We can refund the whole amount in the charge or part of it. The amount shouldn't be more than amount in the charge.

  • descriptionstring

    Description of the refund.

  • reasonstringrequired

    Reason for the refund.

    Allowed values:duplicatefraudulentrequested_by_customer
  • charge_idstringrequired

    Charge id related to this refund.

  • invoice_idstringrequired

    Invoice Id related to the refund. Constraint: Not Null

Response

application/json
  • idstringrequired

    The refund Id

  • objectstring
  • amountinteger<int64>required

    Amount refunded.

  • currencystringrequired

    Three-Letter ISO currency code

    Allowed values:BIFUSDKESXAF
  • descriptionstring

    Description of the refund

  • reasonstringrequired

    Reason for the refund. Either duplicate, fraudulent, requested_by_customer or for an expired capture, expired_uncaptured_charge

    Allowed values:duplicatefraudulentrequested_by_customer
  • statusstring

    Status of the refund. Either succeeded, pending, or failed

    Allowed values:succeededpaidpendingfailed
  • receivingAccountIdstring
  • charge_idstringrequired

    Charge Id associate to this refund

  • created_dateinteger<int64>required

    UTC UNIX Epoch Timestamp in millisecond at which the object was created.

  • source_idstringrequired

    ID of the card account the refund was sent to

  • failure_reasonstringrequired

    Reason of the failure: lost_or_stolen_card, expired_or_canceled_card, or unknown

    Allowed values:lost_or_stolen_cardexpired_or_canceled_cardunknown
  • invoice_idstringrequired

    Id of the invoice the charge was

  • liveboolean

    Whether the object exist in live or test mode.

  • modified_dateinteger<int64>

    UTC UNIX Epoch Timestamp in millisecond at which the object was modified.

  • processing_idstring

    Reference Number of the bank deposit. Constraint: Notnull

Status codes

  • 201Created
  • 400Bad request
  • 401Unauthorized
  • 402Payment required
  • 403Forbidden
  • 404Not found
  • 428Precondition required
  • 500Server error

Request

curl -X POST "https://api.leapa.co/v2/refunds" \
  -H "Authorization: Bearer $LEAPA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 45000,
    "description": "Room 204, two nights",
    "reason": "duplicate",
    "charge_id": "chg_5a90bc71de",
    "invoice_id": "inv_7c1f9a2b48"
  }'

Response

Created

{
  "id": "obj_5f21c8a40b",
  "object": "string",
  "amount": 45000,
  "currency": "BIF",
  "description": "Room 204, two nights",
  "reason": "duplicate",
  "status": "succeeded",
  "receivingAccountId": "00012345678901",
  "charge_id": "chg_5a90bc71de",
  "created_date": 0,
  "source_id": "src_0e7b3c95af",
  "failure_reason": "lost_or_stolen_card",
  "invoice_id": "inv_7c1f9a2b48",
  "live": false,
  "modified_date": 0,
  "processing_id": "string"
}