curl --request POST \
--url https://api.sandbox.pesaswap.io/payments/{payment_id}/cancel \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"cancellation_reason": "requested_by_customer"
}
'{
"allowed_payment_method_types": null,
"amount": 100,
"amount_capturable": 100,
"amount_received": null,
"attempt_count": 1,
"authentication_type": "three_ds",
"authorization_count": null,
"billing": null,
"browser_info": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"cancellation_reason": "requested_by_customer",
"capture_method": "manual",
"capture_on": null,
"client_secret": "pay_kitsDvGdJBCOahPUUYHW_secret_wcV41yrtvLMPxkwPNlAQ",
"connector": "iveri",
"connector_label": null,
"connector_mandate_id": null,
"connector_metadata": null,
"connector_transaction_id": "{9749056F-BC05-45DA-8A8E-5F1F3DA3783C}",
"created": "2026-06-19T12:00:51.333Z",
"currency": "KES",
"customer": {
"email": null,
"id": "initial_payment",
"name": null,
"phone": null,
"phone_country_code": null
},
"customer_id": "initial_payment",
"description": null,
"disputes": null,
"email": null,
"ephemeral_key": null,
"error_code": "-1",
"error_message": "Unable to process the transaction",
"expires_on": "2026-06-19T12:15:51.333Z",
"external_3ds_authentication_attempted": false,
"external_authentication_details": null,
"feature_metadata": null,
"fingerprint": null,
"frm_message": null,
"frm_metadata": null,
"incremental_authorization_allowed": false,
"incremental_authorizations": null,
"mandate_data": null,
"mandate_id": null,
"manual_retry_allowed": true,
"merchant_connector_id": "mca_8tWZkNxGAmASXaKU2vtf",
"merchant_decision": null,
"merchant_id": "merchant_1772185344",
"merchant_order_reference_id": null,
"metadata": null,
"name": null,
"net_amount": 100,
"next_action": null,
"off_session": null,
"order_details": null,
"order_tax_amount": null,
"payment_experience": null,
"payment_id": "pay_kitsDvGdJBCOahPUUYHW",
"payment_link": null,
"payment_method": "card",
"payment_method_data": {
"billing": null,
"card": {
"authentication_data": null,
"card_exp_month": "12",
"card_exp_year": "2030",
"card_extended_bin": null,
"card_holder_name": "Test User",
"card_isin": "424242",
"card_issuer": null,
"card_issuing_country": null,
"card_network": null,
"card_type": null,
"last4": "4242",
"payment_checks": null
}
},
"payment_method_id": null,
"payment_method_status": null,
"payment_method_type": "debit",
"payment_token": "token_zzvyGqQJ1tcXikvGckWi",
"phone": null,
"profile_id": "pro_Cndm5nfd5O5gxx2uoW10",
"reference_id": "pay_kitsDvGdJBCOahPUUYHW_1",
"refunds": null,
"return_url": "https://www.google.com/",
"setup_future_usage": null,
"shipping": null,
"shipping_cost": null,
"split_payments": null,
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"status": "failed",
"surcharge_details": null,
"unified_code": "UE_9000",
"unified_message": "Something went wrong",
"updated": "2026-06-19T12:02:21.154Z"
}Payments - Cancel
A Payment could can be cancelled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_customer_action.
This call applies to card payments only, and only before the amount is captured — use it to void an authorised payment that has not yet been captured. Wallet payments — M-Pesa Express, Airtel Money, and MTN MoMo — cannot be cancelled this way.
curl --request POST \
--url https://api.sandbox.pesaswap.io/payments/{payment_id}/cancel \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"cancellation_reason": "requested_by_customer"
}
'{
"allowed_payment_method_types": null,
"amount": 100,
"amount_capturable": 100,
"amount_received": null,
"attempt_count": 1,
"authentication_type": "three_ds",
"authorization_count": null,
"billing": null,
"browser_info": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"cancellation_reason": "requested_by_customer",
"capture_method": "manual",
"capture_on": null,
"client_secret": "pay_kitsDvGdJBCOahPUUYHW_secret_wcV41yrtvLMPxkwPNlAQ",
"connector": "iveri",
"connector_label": null,
"connector_mandate_id": null,
"connector_metadata": null,
"connector_transaction_id": "{9749056F-BC05-45DA-8A8E-5F1F3DA3783C}",
"created": "2026-06-19T12:00:51.333Z",
"currency": "KES",
"customer": {
"email": null,
"id": "initial_payment",
"name": null,
"phone": null,
"phone_country_code": null
},
"customer_id": "initial_payment",
"description": null,
"disputes": null,
"email": null,
"ephemeral_key": null,
"error_code": "-1",
"error_message": "Unable to process the transaction",
"expires_on": "2026-06-19T12:15:51.333Z",
"external_3ds_authentication_attempted": false,
"external_authentication_details": null,
"feature_metadata": null,
"fingerprint": null,
"frm_message": null,
"frm_metadata": null,
"incremental_authorization_allowed": false,
"incremental_authorizations": null,
"mandate_data": null,
"mandate_id": null,
"manual_retry_allowed": true,
"merchant_connector_id": "mca_8tWZkNxGAmASXaKU2vtf",
"merchant_decision": null,
"merchant_id": "merchant_1772185344",
"merchant_order_reference_id": null,
"metadata": null,
"name": null,
"net_amount": 100,
"next_action": null,
"off_session": null,
"order_details": null,
"order_tax_amount": null,
"payment_experience": null,
"payment_id": "pay_kitsDvGdJBCOahPUUYHW",
"payment_link": null,
"payment_method": "card",
"payment_method_data": {
"billing": null,
"card": {
"authentication_data": null,
"card_exp_month": "12",
"card_exp_year": "2030",
"card_extended_bin": null,
"card_holder_name": "Test User",
"card_isin": "424242",
"card_issuer": null,
"card_issuing_country": null,
"card_network": null,
"card_type": null,
"last4": "4242",
"payment_checks": null
}
},
"payment_method_id": null,
"payment_method_status": null,
"payment_method_type": "debit",
"payment_token": "token_zzvyGqQJ1tcXikvGckWi",
"phone": null,
"profile_id": "pro_Cndm5nfd5O5gxx2uoW10",
"reference_id": "pay_kitsDvGdJBCOahPUUYHW_1",
"refunds": null,
"return_url": "https://www.google.com/",
"setup_future_usage": null,
"shipping": null,
"shipping_cost": null,
"split_payments": null,
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"status": "failed",
"surcharge_details": null,
"unified_code": "UE_9000",
"unified_message": "Something went wrong",
"updated": "2026-06-19T12:02:21.154Z"
}Authorizations
Body
Response
Payment canceled
The status of the current payment that was made
succeeded, failed, cancelled, processing, requires_customer_action, requires_merchant_action, requires_payment_method, requires_confirmation, requires_capture, partially_captured, partially_captured_and_capturable The three letter ISO currency code in uppercase. Eg: 'USD' for the United States Dollar.
AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLP, CNY, COP, CRC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLE, SLL, SOS, SRD, SSP, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, USDC, USDT, UYU, UZS, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL Indicates that you intend to make future payments with the payment methods used for this Payment. Providing this parameter will attach the payment method to the Customer, if present, after the Payment is confirmed and any required actions from the user are complete.
- On_session - Payment method saved only at pesaswap when consent is provided by the user. CVV will asked during the returning user payment
- Off_session - Payment method saved at both pesaswap and Processor when consent is provided by the user. No input is required during the returning user payment.
off_session, on_session Set to true to indicate that the customer is not in your checkout flow during this payment, and therefore is unable to authenticate. This parameter is intended for scenarios where you collect card details and charge them later. This parameter can only be used with confirm=true.
true
Default value if not passed is set to 'automatic' which results in Auth and Capture in one single API request. Pass 'manual' or 'manual_multiple' in case you want do a separate Auth and Capture by first authorizing and placing a hold on your customer's funds so that you can use the Payments/Capture endpoint later to capture the authorized amount. Pass 'manual' if you want to only capture the amount later once or 'manual_multiple' if you want to capture the funds multiple times later. Both 'manual' and 'manual_multiple' are only supported by a specific list of processors
automatic, manual, manual_multiple, scheduled, sequential_automatic Pass this parameter to force 3DS or non 3DS auth for this payment. Some connectors will still force 3DS auth even in case of passing 'no_three_ds' here and vice versa. Default value is 'no_three_ds' if not set
three_ds, no_three_ds Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that’s set on the account to form the complete statement descriptor. Maximum 255 characters for the concatenated descriptor.
255"Payment for shoes purchase"
Indicates the sub type of payment method. Eg: 'google_pay' & 'apple_pay' for wallets.
ach, affirm, afterpay_clearpay, alfamart, ali_pay, ali_pay_hk, alma, amazon_pay, apple_pay, atome, bacs, bancontact_card, becs, benefit, bizum, blik, boleto, bca_bank_transfer, bni_va, bri_va, card_redirect, cimb_va, pay_bill, pay_till, classic, credit, crypto_currency, cashapp, dana, danamon_va, debit, duit_now, efecty, eps, fps, evoucher, giropay, givex, google_pay, go_pay, gcash, ideal, interac, indomaret, klarna, kakao_pay, local_bank_redirect, mandiri_va, knet, mb_way, mobile_pay, momo, momo_atm, pesa_link, online_banking_thailand, online_banking_czech_republic, online_banking_finland, online_banking_fpx, online_banking_poland, online_banking_slovakia, oxxo, pago_efectivo, permata_bank_transfer, open_banking_uk, pay_bright, paypal, paze, pix, pay_safe_card, przelewy24, prompt_pay, pse, red_compra, red_pagos, samsung_pay, sepa, sofort, swish, touch_n_go, trustly, twint, upi_collect, upi_intent, vipps, viet_qr, venmo, walley, we_chat_pay, seven_eleven, lawson, mini_stop, family_mart, seicomart, pay_easy, local_bank_transfer, mifinity, open_banking_pis, m_pesa_express, airtel_money, momo_mtn, m_pesa_imt AF, AX, AL, DZ, AS, AD, AO, AI, AQ, AG, AR, AM, AW, AU, AT, AZ, BS, BH, BD, BB, BY, BE, BZ, BJ, BM, BT, BO, BQ, BA, BW, BV, BR, IO, BN, BG, BF, BI, KH, CM, CA, CV, KY, CF, TD, CL, CN, CX, CC, CO, KM, CG, CD, CK, CR, CI, HR, CU, CW, CY, CZ, DK, DJ, DM, DO, EC, EG, SV, GQ, ER, EE, ET, FK, FO, FJ, FI, FR, GF, PF, TF, GA, GM, GE, DE, GH, GI, GR, GL, GD, GP, GU, GT, GG, GN, GW, GY, HT, HM, VA, HN, HK, HU, IS, IN, ID, IR, IQ, IE, IM, IL, IT, JM, JP, JE, JO, KZ, KE, KI, KP, KR, KW, KG, LA, LV, LB, LS, LR, LY, LI, LT, LU, MO, MK, MG, MW, MY, MV, ML, MT, MH, MQ, MR, MU, YT, MX, FM, MD, MC, MN, ME, MS, MA, MZ, MM, NA, NR, NP, NL, NC, NZ, NI, NE, NG, NU, NF, MP, NO, OM, PK, PW, PS, PA, PG, PY, PE, PH, PN, PL, PT, PR, QA, RE, RO, RU, RW, BL, SH, KN, LC, MF, PM, VC, WS, SM, ST, SA, SN, RS, SC, SL, SG, SX, SK, SI, SB, SO, ZA, GS, SS, ES, LK, SD, SR, SJ, SZ, SE, CH, SY, TW, TJ, TZ, TH, TL, TG, TK, TO, TT, TN, TR, TM, TC, TV, UG, UA, AE, GB, UM, UY, UZ, VU, VE, VN, VG, VI, WF, EH, YE, ZM, ZW, US Allowed Payment Method Types for a given PaymentIntent
Indicates the sub type of payment method. Eg: 'google_pay' & 'apple_pay' for wallets.
ach, affirm, afterpay_clearpay, alfamart, ali_pay, ali_pay_hk, alma, amazon_pay, apple_pay, atome, bacs, bancontact_card, becs, benefit, bizum, blik, boleto, bca_bank_transfer, bni_va, bri_va, card_redirect, cimb_va, pay_bill, pay_till, classic, credit, crypto_currency, cashapp, dana, danamon_va, debit, duit_now, efecty, eps, fps, evoucher, giropay, givex, google_pay, go_pay, gcash, ideal, interac, indomaret, klarna, kakao_pay, local_bank_redirect, mandiri_va, knet, mb_way, mobile_pay, momo, momo_atm, pesa_link, online_banking_thailand, online_banking_czech_republic, online_banking_finland, online_banking_fpx, online_banking_poland, online_banking_slovakia, oxxo, pago_efectivo, permata_bank_transfer, open_banking_uk, pay_bright, paypal, paze, pix, pay_safe_card, przelewy24, prompt_pay, pse, red_compra, red_pagos, samsung_pay, sepa, sofort, swish, touch_n_go, trustly, twint, upi_collect, upi_intent, vipps, viet_qr, venmo, walley, we_chat_pay, seven_eleven, lawson, mini_stop, family_mart, seicomart, pay_easy, local_bank_transfer, mifinity, open_banking_pis, m_pesa_express, airtel_money, momo_mtn, m_pesa_imt Merchant's identifier for the payment/invoice. This will be sent to the connector if the connector provides support to accept multiple reference ids. In case the connector supports only one reference id, Pesaswap's Payment ID will be sent as reference.
255"Custom_Order_id_123"