After creating the payment intent, you need to confirm it to capture the amount. This usually happens when the end-user has completed all the necessary steps (such as providing payment information or accepting the terms and conditions).
Confirm a Payment Intent
In order to collect payment from the customer, you must confirm the previously generated payment intent. You can confirm the payment intent as many times as necessary until it is confirmed with a successful payment.
Prepare your request
The endpoint to use is POST https://pay.sandbox.yabetoopay.com/v1/payment-intents/:id/confirm for the sandbox environment and POST https://pay.api.yabetoopay.com/v1/payment-intents/:id/confirm for the production environment, where :id is the payment intent ID.
You need to use the following parameters to confirm the payment intent:
client_secret: This parameter is the secret identifier of the payment intent. It is used to perform secure operations related to this specific payment intent.
- Customer’s informations (optional):
first_name: The first name of the customer
last_name: The last name of the customer
receipt_email: The email address of the customer
payment_method_data: This section contains the specific details of the payment method chosen by the customer.
type: The type of payment method momo (Mobile Money).
momo: The mobile money details.
country: The country code of the mobile money.
msisdn: The mobile money number in international format (e.g., +242XXXXX).
operator_name: The operator name of the mobile money.
client_secret must be kept confidential and must never be exposed in the
frontend or client code. It must only be used on the server side. It is used
to authenticate the payment intent.
The request body must be in JSON:
{
"client_secret": "pi_AmBKcXsbKWQZOjPLDEQoxW06U35Xqt5nt1GN_secret_scKRe9xZ4l2ST2Yy6uwUQ0qBMNC9l2Z8vGGY",
"first_name": "Loumbou",
"last_name": "Scoty",
"receipt_email": "scott@artkodes.com",
"payment_method_data": {
"type": "momo",
"momo": {
"country": "cg",
"msisdn": "242065607120",
"operator_name": "mtn"
}
}
}
const response = await fetch(
"https://pay.sandbox.yabetoopay.com/v1/payment-intents/PAYMENT_INTENT_ID/confirm",
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer YOUR_SECRET_KEY",
},
body: JSON.stringify({
client_secret: "YOUR_CLIENT_SECRET",
first_name: "Loumbou",
last_name: "Scoty",
receipt_email: "scott@artkodes.com",
payment_method_data: {
type: "momo",
momo: {
country: "cg",
msisdn: "242065607120",
operator_name: "mtn",
},
},
}),
}
);
const data = await response.json();
By calling this method, the amount associated with the payment intent will be captured, and the payment will be considered successful if all goes well.
With this two-step model, developers can gain greater control over the payment process while delivering a smooth user experience. You can adapt these two steps to your specific needs (for example, pre-authorization or deferred payment).
Error handling is important, as confirmation of a payment intention can fail
for a variety of reasons (insufficient funds, incorrect payment information,
etc.).
Response
200 OK - Payment Succeeded
The response body will contain the following parameters:
{
"intentId": "pi_3r8utQTUlCY5hjV2pMtjtaNYsZ30FylO3PZk",
"financialTransactionId": "7331529368",
"transactionId": "pi_3r8utQTUlCY5hjV2pMtjtaNYsZ30FylO3PZk",
"amount": 2228,
"currency": "xaf",
"status": "succeeded",
"captured": true,
"externalId": "ext_7hp8lsjCFwTemoeL",
"id": "ch_ADdQhObdEDlz4L0kl7qNRniFjruNcrcY85xq",
"createdAt": "2026-02-16T06:51:43.103+00:00",
"updatedAt": "2026-02-16T06:51:43.177+00:00",
"paymentMethodId": "pm_evILNJIgAyJs7S4KYmy5n5Ect8itay2GeycL"
}
200 OK - Payment Failed
When the payment fails (e.g., timeout, insufficient balance), the response will still return a 200 status code but with a failed status:
{
"intentId": "pi_HUHh0kAg9H8QZvHtFf0taIspdWlUVftSOLhB",
"transactionId": "pi_HUHh0kAg9H8QZvHtFf0taIspdWlUVftSOLhB",
"amount": 10363,
"currency": "xaf",
"status": "expired",
"captured": false,
"externalId": "ext_mQliBh5ZbdQ9w15S",
"failureMessage": "Transaction timed out",
"failureCode": "Transaction timed out",
"id": "ch_nZBtA8euTJFnpFMTSO402WJOP1g2WwWSGiC7",
"createdAt": "2026-02-16T14:07:02.061+00:00",
"updatedAt": "2026-02-16T14:07:02.190+00:00",
"paymentMethodId": "pm_tU0HivHLBjozujmhwbVk3LO0B2ttcd0Rk1j3"
}
422 Bad Request
If the operation is not permitted, the server will return a 422 status code with an error message.
{
"status": 422,
"path": "/v1/payment-intents/pi_2GlfKbBC6IMYBPDhOaFIRdn0nrXDDEAjBxyW/confirm",
"timestamp": "2026-02-16T15:54:49.730+00:00",
"code": "E_OPERATION_NOT_PERMITTED",
"message": "Operation not permitted",
"detail": "You are not permitted to perform this operation."
}
404 Not Found
If the payment intent ID is invalid or not found, the server will return a 404 status code.
{
"message": "Row not found"
}
401 Unauthorized
If the secret key is invalid, the server will return a 401 status code with an error message.
{
"error": {
"message": "Unauthorized",
"code": "Unauthorized"
}
}