Cancel a payment.

POST /api/payments/cancel-payment

Cancel a pending payment of the provided payment identifier. Will fail if the payment has already been cancelled, errored, or completed. Payments will automatically cancel if they are not completed after 15 minutes, which will mark them as errored.

Body

Responses

  • 200 OK

    Hide response attributes Show response attributes object
    • paymentIdentifier string Required

      Unique identifier for the created payment.

    • status string Required

      Unique identifier for the created payment. Successful transactions will be marked as completed. Transactions that have failed due to technical reasons will be marked Error, while transactions that were flagged and denied by our Anti-Money Laundering program will be marked as AMLError. Transactions that are flagged will always automatically return money to the user.

      Values are Waiting, Cancelled, Error, AMLError, or Completed.

    • isComplete boolean Required

      Simple boolean to determine if a payment has successfully completed.

    • createdDatetime string(date-time) Required

      Datetime of when the payment was first created, in the format: uuuu-MM-dd'T'HH:mm:ss

    • orderId string

      Optional identifier for the transaction for merchant use. Not used by Madora.

    • Optional description for the transaction for merchant use. Not used by Madora.

  • 400 Bad Request

    Hide response attributes Show response attributes object
    • errorCode string Required

      Values are internal, invalidAmount, badInput, transactionTooLarge, unsupportedLocation, notEnabled, paymetNotFound, wrongAccount, alreadyCancelled, authMissing, or authInvalid.

    • errorMessage string Required
  • 401 Unauthorized

    Hide response attributes Show response attributes object
    • errorCode string Required

      Values are internal, invalidAmount, badInput, transactionTooLarge, unsupportedLocation, notEnabled, paymetNotFound, wrongAccount, alreadyCancelled, authMissing, or authInvalid.

    • errorMessage string Required
  • 500 Internal Server Error

    Hide response attributes Show response attributes object
    • errorCode string Required

      Values are internal, invalidAmount, badInput, transactionTooLarge, unsupportedLocation, notEnabled, paymetNotFound, wrongAccount, alreadyCancelled, authMissing, or authInvalid.

    • errorMessage string Required
POST /api/payments/cancel-payment
curl \
 -X POST https://madora.io/api/payments/cancel-payment \
 --user "username:password" \
 -H "Content-Type: application/json" \
 -d '{"paymentIdentifier":"f390682f-4ded-41d6-adfd-80c54e85d73f"}'
Request example
{
  "paymentIdentifier": "f390682f-4ded-41d6-adfd-80c54e85d73f"
}
Request examples
{
  "paymentIdentifier": "f390682f-4ded-41d6-adfd-80c54e85d73f"
}
Response examples (200)
{
  "paymentIdentifier": "f390682f-4ded-41d6-adfd-80c54e85d73f",
  "status": "Waiting",
  "isComplete": true,
  "createdDatetime": "2023-05-04T09:42:00+00:00",
  "orderId": "1",
  "orderDescription": "test transaction"
}
Response examples (200)
{
  "paymentIdentifier": "f390682f-4ded-41d6-adfd-80c54e85d73f",
  "status": "Waiting",
  "isComplete": true,
  "createdDatetime": "2024-05-04T09:42:00+00:00",
  "orderId": "1",
  "orderDescription": "test transaction"
}
Response examples (400)
{
  "errorCode": "internal",
  "errorMessage": "string"
}
Response examples (400)
{
  "errorCode": "internal",
  "errorMessage": "string"
}
Response examples (401)
{
  "errorCode": "internal",
  "errorMessage": "string"
}
Response examples (401)
{
  "errorCode": "internal",
  "errorMessage": "string"
}
Response examples (500)
{
  "errorCode": "internal",
  "errorMessage": "string"
}
Response examples (500)
{
  "errorCode": "internal",
  "errorMessage": "string"
}