Cancelling a Payment Intent
Modem Pay allows partners to cancel a Payment Intent that has not yet been fully processed or charged. This can be used to stop a payment that is no longer needed or was created by mistake.
Endpoint
POST /payments/cancel/:id
:idis thepayment_intent_idof the Payment Intent you want to cancel.
Request Body (Optional)
You can provide a reason for cancellation:
{
"reason": "Customer requested cancellation"
}
Curl Example
curl -X POST "https://api.modempay.com/h2h/v1/payments/cancel/YOUR_PAYMENT_INTENT_ID" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reason": "Customer requested cancellation"
}'
Notes
- Cancelling a Payment Intent prevents any further charges on that intent.
- If a direct charge was already processed, cancellation may not reverse the transaction; check the response and status in the webhook.
- You can use this endpoint to provide context to your internal systems or customer support by including the
reasonfield. - Webhooks will notify your system if the cancellation is successful.