Skip to main content
Version: 2019-05-29 (Current)

Expire a charge

Manually expire a pending charge that has not yet been authorized. Only applicable to certain payment methods with redirect-based flows.


๐Ÿ”‘API Credentials

Request Parametersโ€‹

Required - 1 fieldRequired Parameters
โ–ผ
`id`STRING(required)
The charge ID to expire. Must be a pending charge that has not yet been authorized. Only works with supported payment sources (Alipay CN/HK, DANA, GCash, KakaoPay, PayPay, Touch 'n Go).
Example:"chrg_test_5xuy4w91xqz7d1w9u0t"
Constraints:Must start with chrg_, Charge status must be pending, Must be created via supported sources

Responsesโ€‹

200

Successfully expired

Charge has been marked as expired. Customer can no longer complete payment.

Key field changes after expiration:
  • status - Changes from pending to expired
  • expired - Changes from false to true
  • expired_at - Set to current timestamp

400

Bad request

Request validation failed.

Common causes:
  • Invalid charge ID format
  • Charge not eligible for expiration

401

Unauthorized

Authentication failed. Invalid or missing API key.

Common causes:
  • Missing Authorization header
  • Invalid secret key
  • Using public key instead of secret key

404

Not found

Charge ID does not exist.

Common causes:
  • Incorrect charge ID
  • Charge from different account
  • Using test key for live charge (or vice versa)

422

Unprocessable entity

Charge cannot be expired.

Common causes:
  • Charge is not pending (already successful, failed, or expired)
  • Charge already authorized
  • Payment method not supported for manual expiration
  • Charge created with card instead of supported source

Code samplesโ€‹

curl https://api.omise.co/charges/chrg_test_5xuy4w91xqz7d1w9u0t/expire \
-X POST \
-u skey_test_5xuy4w91xqz7d1w9u0t:

Error and result codesโ€‹

Common Error Codesโ€‹

CodeDescriptionResolution
not_foundCharge ID doesn't existVerify charge ID is correct
not_pendingCharge is not pendingCan only expire pending charges
already_expiredCharge already expiredNo action needed
not_expirablePayment method not supportedCheck supported sources
already_authorizedCharge already authorizedCannot expire authorized charges

Supported Payment Methodsโ€‹

Payment MethodSupportedNotes
Alipay CNYesCan expire pending charges
Alipay HKYesCan expire pending charges
DANAYesCan expire pending charges
GCashYesCan expire pending charges
KakaoPayYesCan expire pending charges
PayPayYesCan expire pending charges
Touch 'n GoYesCan expire pending charges
Credit CardNoCards have different flow
PromptPayNoPromptPay expires automatically

Try it outโ€‹

Required - 1 fields
โ–ผ