Mark charge as paid
Mark a test charge as paid. This endpoint is primarily used for testing and reconciliation purposes with limited support for specific payment methods.
API Credentials
Request Parametersโ
Required - 1 fieldRequired Parameters
`id`STRING(required)
The charge ID to mark as paid. Must be a test charge that is eligible for manual status updates.
Responsesโ
200
Successfully marked as paidCharge status updated to successful and marked as paid.
Key field changes:
status- Changes to successfulpaid- Set to truepaid_at- Set to current timestamptransaction- Transaction ID created
400
Bad requestRequest validation failed.
Common causes:
- Invalid charge ID format
- Charge not eligible for manual payment
- Using live charge (only test charges supported)
401
UnauthorizedAuthentication failed. Invalid or missing API key.
Common causes:
- Missing Authorization header
- Invalid secret key
- Using public key instead of secret key
404
Not foundCharge ID does not exist.
Common causes:
- Incorrect charge ID
- Charge from different account
- Using test key for live charge (or vice versa)
Code samplesโ
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/charges/chrg_test_5xuy4w91xqz7d1w9u0t/mark_as_paid \
-X POST \
-u skey_test_5xuy4w91xqz7d1w9u0t:
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
charge = Omise::Charge.mark_paid('chrg_test_5xuy4w91xqz7d1w9u0t')
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
charge = omise.Charge.mark_paid('chrg_test_5xuy4w91xqz7d1w9u0t')
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const charge = await omise.charges.markPaid('chrg_test_5xuy4w91xqz7d1w9u0t');
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$charge = OmiseCharge::retrieve('chrg_test_5xuy4w91xqz7d1w9u0t');
$charge->markPaid();
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Charge charge = client.charges().markPaid("chrg_test_5xuy4w91xqz7d1w9u0t")
.send();
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var charge = await client.Charges.MarkPaid("chrg_test_5xuy4w91xqz7d1w9u0t");
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
charge, _ := client.MarkChargePaid("chrg_test_5xuy4w91xqz7d1w9u0t", nil)
Error and result codesโ
Common Error Codesโ
| Code | Description | Resolution |
|---|---|---|
not_found | Charge ID doesn't exist | Verify charge ID is correct |
not_eligible | Charge cannot be marked as paid | Check charge status and payment method |
already_paid | Charge already paid | No action needed |
not_test_charge | Only test charges supported | Use test key and test charge |
Try it outโ
Required - 1 fields