SW SwiftWallet
Base URL https://swiftwallet.co.ke/v3

Reversals

Reverse a completed B2C, B2Pochi or B2B payment.

POST /v3/reversals Request a reversal Try it

Asks M-Pesa to reverse a payout. The key needs the scope of the original payment (b2c_payments also covers wallet withdrawals).

Scope: b2c_payments or b2pochi_payments or b2b_payments

Parameters

FieldInTypeRequiredDescription
transaction_id body integer unless mpesa_receipt is sent SwiftWallet transaction id of the original payout.
Range 1 – …
mpesa_receipt body string unless transaction_id is sent M-Pesa receipt of the original payout, letters and digits, max 50.
amount body integer yes Must equal the original amount.
Range 1 – …
remarks body string no Max 100. Default "Reversal".
occasion body string no Max 100.
callback_url body url no Public HTTPS URL for the signed result callback, max 500. Overrides the key's webhook URL for this transaction.

Request

curl -X POST "https://swiftwallet.co.ke/v3/reversals" \
  -H "Authorization: Bearer $SWIFTWALLET_API_KEY" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"transaction_id":123,"amount":500,"remarks":"Customer refund"}'

Response fields

success status (INITIATED) message reversal_transaction_id original_transaction_id reference originatorConversationID conversationID reversal_details.amount reversal_details.original_product reversal_details.original_mpesa_receipt

A successful reversal callback has status "reversed" and credits the payments wallet once.