Create Payment
/v1/payments/create
Creates a new payment and initiates the transaction with the payment provider. Requires the X-API-Key header. The response contains a hosted payment page URL plus the raw QR string or virtual account number, depending on the payment method.
Request Body
merchantOrderIdstringrequiredYour own order ID, 1–50 characters. Must be unique per account — reusing an existing value returns 409.
amountintegerrequiredPayment amount in IDR (Indonesian Rupiah). Must be an integer greater than 0.
productDetailsstringrequiredProduct description, 1–255 characters.
paymentMethodstringPayment method code. Defaults to SP (QRIS) when enabled, otherwise to the first method enabled by the admin. Must be one of the methods enabled by the Artos admin, otherwise the request fails with 400.
customerEmailstringCustomer email address. Must be a valid email.
customerNamestringCustomer name.
returnUrlstringURL to redirect the customer to after payment. Must be an http or https URL.
expiryPeriodintegerPayment expiry in minutes, between 1 and 10080 (7 days). Defaults to 60.
Response
idstringPayment link ID.
slugstringSlug of the hosted payment page.
merchantOrderIdstringYour merchantOrderId, echoed back.
amountintegerPayment amount in IDR.
paymentMethodstringPayment method used for this transaction.
referencestringPayment provider (Duitku) reference.
qrStringstring | nullQRIS payload to render as a QR code, when applicable.
vaNumberstring | nullVirtual account number, when applicable.
duitkuPaymentUrlstring | nullPayment provider's own payment page, when available.
paymentUrlstringArtos hosted payment page (https://<frontend>/pay/<slug>).
expiredAtstringExpiry time (ISO 8601).
createdAtstringCreation time (ISO 8601).
The recommended flow is to redirect your customer to paymentUrl. Alternatively, render qrString as a QR code or display vaNumber in your own UI. The create response does not include a status — use webhooks or Get Payment to track the outcome.
Examples
curl -X POST https://api-artos.kasir.ai/v1/payments/create \
-H "X-API-Key: art_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"merchantOrderId": "ORDER-001",
"amount": 50000,
"productDetails": "Premium Plan",
"paymentMethod": "SP",
"customerEmail": "[email protected]",
"customerName": "Budi Santoso",
"returnUrl": "https://yoursite.com/success",
"expiryPeriod": 60
}'const response = await fetch('https://api-artos.kasir.ai/v1/payments/create', {
method: 'POST',
headers: {
'X-API-Key': process.env.ARTOS_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
merchantOrderId: 'ORDER-001',
amount: 50000,
productDetails: 'Premium Plan',
}),
})
const { success, data, error } = await response.json()
if (success) {
// Redirect the customer to the hosted payment page
redirect(data.paymentUrl)
}{
"success": true,
"data": {
"id": "6f1c2a9e-3b7d-4c1a-9f0e-2d5b8a4c7e11",
"slug": "inv-a1B2c3D4e5",
"merchantOrderId": "ORDER-001",
"amount": 50000,
"paymentMethod": "SP",
"reference": "DS1234525ABCDEFGH",
"qrString": "00020101021226...",
"vaNumber": null,
"duitkuPaymentUrl": "https://app-sandbox.duitku.com/redirect_checkout?reference=...",
"paymentUrl": "https://artos.dev/pay/inv-a1B2c3D4e5",
"expiredAt": "2025-01-01T01:00:00.000Z",
"createdAt": "2025-01-01T00:00:00.000Z"
}
}Errors
{
"success": false,
"error": "Invalid input",
"details": {
"fieldErrors": {
"amount": ["Expected number, received string"]
}
}
}{ "success": false, "error": "merchantOrderId already exists" }{ "success": false, "error": "Payment provider error: ..." }See Error Handling for the full list of status codes.