Confirm a PaymentIntent
curl --request POST \
--url https://api.viarosandbox.com/v1/public/payment_intents/{id}/confirm \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"client_secret": "<string>",
"payment_method_data": {
"type": "<string>",
"phone": "<string>",
"network": "<string>",
"token": "<string>"
}
}
'import requests
url = "https://api.viarosandbox.com/v1/public/payment_intents/{id}/confirm"
payload = {
"client_secret": "<string>",
"payment_method_data": {
"type": "<string>",
"phone": "<string>",
"network": "<string>",
"token": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
client_secret: '<string>',
payment_method_data: {type: '<string>', phone: '<string>', network: '<string>', token: '<string>'}
})
};
fetch('https://api.viarosandbox.com/v1/public/payment_intents/{id}/confirm', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.viarosandbox.com/v1/public/payment_intents/{id}/confirm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'client_secret' => '<string>',
'payment_method_data' => [
'type' => '<string>',
'phone' => '<string>',
'network' => '<string>',
'token' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.viarosandbox.com/v1/public/payment_intents/{id}/confirm"
payload := strings.NewReader("{\n \"client_secret\": \"<string>\",\n \"payment_method_data\": {\n \"type\": \"<string>\",\n \"phone\": \"<string>\",\n \"network\": \"<string>\",\n \"token\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.viarosandbox.com/v1/public/payment_intents/{id}/confirm")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"client_secret\": \"<string>\",\n \"payment_method_data\": {\n \"type\": \"<string>\",\n \"phone\": \"<string>\",\n \"network\": \"<string>\",\n \"token\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.viarosandbox.com/v1/public/payment_intents/{id}/confirm")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"client_secret\": \"<string>\",\n \"payment_method_data\": {\n \"type\": \"<string>\",\n \"phone\": \"<string>\",\n \"network\": \"<string>\",\n \"token\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_bodyPayments API
Confirm a PaymentIntent
Confirm that your customer intends to pay with a specified payment method (Mobile Money, Card, etc.).
POST
/
public
/
payment_intents
/
{id}
/
confirm
Confirm a PaymentIntent
curl --request POST \
--url https://api.viarosandbox.com/v1/public/payment_intents/{id}/confirm \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"client_secret": "<string>",
"payment_method_data": {
"type": "<string>",
"phone": "<string>",
"network": "<string>",
"token": "<string>"
}
}
'import requests
url = "https://api.viarosandbox.com/v1/public/payment_intents/{id}/confirm"
payload = {
"client_secret": "<string>",
"payment_method_data": {
"type": "<string>",
"phone": "<string>",
"network": "<string>",
"token": "<string>"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
client_secret: '<string>',
payment_method_data: {type: '<string>', phone: '<string>', network: '<string>', token: '<string>'}
})
};
fetch('https://api.viarosandbox.com/v1/public/payment_intents/{id}/confirm', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.viarosandbox.com/v1/public/payment_intents/{id}/confirm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'client_secret' => '<string>',
'payment_method_data' => [
'type' => '<string>',
'phone' => '<string>',
'network' => '<string>',
'token' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.viarosandbox.com/v1/public/payment_intents/{id}/confirm"
payload := strings.NewReader("{\n \"client_secret\": \"<string>\",\n \"payment_method_data\": {\n \"type\": \"<string>\",\n \"phone\": \"<string>\",\n \"network\": \"<string>\",\n \"token\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.viarosandbox.com/v1/public/payment_intents/{id}/confirm")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"client_secret\": \"<string>\",\n \"payment_method_data\": {\n \"type\": \"<string>\",\n \"phone\": \"<string>\",\n \"network\": \"<string>\",\n \"token\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.viarosandbox.com/v1/public/payment_intents/{id}/confirm")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"client_secret\": \"<string>\",\n \"payment_method_data\": {\n \"type\": \"<string>\",\n \"phone\": \"<string>\",\n \"network\": \"<string>\",\n \"token\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_bodyConfirming a PaymentIntent fulfills the payment by attaching payment method details (e.g. Mobile Money phone number and operator, Card token, or Bank Account).
If the payment method requires authorization from the customer (such as entering a PIN on their mobile phone for MTN/Orange or performing 3D Secure for cards), the response status transitions to
requires_action and contains instructions to complete the payment.
Request Path & Parameters
string
required
The unique identifier of the PaymentIntent to confirm (e.g.,
pi_550e8400e29b41d4a716446655440000).string
required
The client secret of the PaymentIntent, provided when creating the intent.
object
required
Details for the payment method being used.
Show payment_method_data fields
Show payment_method_data fields
string
required
Payment method type:
mobile_money, card, paypal, bank_transfer, or manual_ussd.string
Customer phone number in international E.164 format (for
mobile_money).string
Mobile money operator:
MTN, ORANGE, MOOV, WAVE, MPESA, EXPRESS_UNION.string
Payment token for card or third-party method.
Code Examples
curl -X POST https://api.viarosandbox.com/v1/public/payment_intents/pi_550e8400e29b41d4a716446655440000/confirm \
-H "Content-Type: application/json" \
-d '{
"client_secret": "pi_550e8400e29b41d4a716446655440000_secret_a1b2c3d4e5f6",
"payment_method_data": {
"type": "mobile_money",
"phone": "+237671234567",
"network": "MTN"
}
}'
import requests
intent_id = "pi_550e8400e29b41d4a716446655440000"
client_secret = f"{intent_id}_secret_a1b2c3d4e5f6"
url = f"https://api.viarosandbox.com/v1/public/payment_intents/{intent_id}/confirm"
payload = {
"client_secret": client_secret,
"payment_method_data": {
"type": "mobile_money",
"phone": "+237671234567",
"network": "MTN"
}
}
response = requests.post(url, json=payload)
print(response.json())
const axios = require('axios');
async function confirmIntent() {
const intentId = 'pi_550e8400e29b41d4a716446655440000';
const clientSecret = `${intentId}_secret_a1b2c3d4e5f6`;
const response = await axios.post(
`https://api.viarosandbox.com/v1/public/payment_intents/${intentId}/confirm`,
{
client_secret: clientSecret,
payment_method_data: {
type: 'mobile_money',
phone: '+237671234567',
network: 'MTN'
}
}
);
console.log(response.data);
}
confirmIntent();
Response (Requires Action - Mobile Money USSD Prompt)
{
"id": "pi_550e8400e29b41d4a716446655440000",
"status": "requires_action",
"amount": 25000,
"currency": "XAF",
"next_action": {
"type": "verify_with_phone",
"instructions": "A push notification has been sent to +237671234567. Please confirm the prompt on your phone by entering your Mobile Money PIN."
}
}
Response (Succeeded)
{
"id": "pi_550e8400e29b41d4a716446655440000",
"status": "succeeded",
"amount": 25000,
"currency": "XAF",
"transaction_id": "tx_90123abcde",
"customer_email": "[email protected]"
}

