Approve a payment attempt
curl --request POST \
--url https://api.sandbox.primer.io/payment-attempts/{id}/approve \
--header 'X-API-KEY: <api-key>' \
--header 'X-API-VERSION: <x-api-version>'import requests
url = "https://api.sandbox.primer.io/payment-attempts/{id}/approve"
headers = {
"X-API-VERSION": "<x-api-version>",
"X-API-KEY": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-VERSION': '<x-api-version>', 'X-API-KEY': '<api-key>'}
};
fetch('https://api.sandbox.primer.io/payment-attempts/{id}/approve', 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.sandbox.primer.io/payment-attempts/{id}/approve",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>",
"X-API-VERSION: <x-api-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.primer.io/payment-attempts/{id}/approve"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-VERSION", "<x-api-version>")
req.Header.Add("X-API-KEY", "<api-key>")
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.sandbox.primer.io/payment-attempts/{id}/approve")
.header("X-API-VERSION", "<x-api-version>")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.primer.io/payment-attempts/{id}/approve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-VERSION"] = '<x-api-version>'
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"paymentAttemptId": "6c5d3a30-3c2e-4f55-9d8e-5b3d5e3a5c7f",
"paymentId": "IHQlakKC"
}
Approve a payment attempt
Approve a payment attempt that is awaiting merchant approval, and trigger payment authorization on Primer’s side.
This endpoint is the merchant entry-point of the Backend-Driven CIT (MANUAL approval) flow: after the SDK tokenises a payment method and the merchant backend has decided the payment should proceed (e.g. after a fraud check or inventory validation), the backend calls this endpoint to hand off orchestration to Primer (3DS, retries, webhooks).
The paymentAttemptId is the idempotency key: concurrent or retried calls converge on a single downstream payment.
POST
/
payment-attempts
/
{id}
/
approve
Approve a payment attempt
curl --request POST \
--url https://api.sandbox.primer.io/payment-attempts/{id}/approve \
--header 'X-API-KEY: <api-key>' \
--header 'X-API-VERSION: <x-api-version>'import requests
url = "https://api.sandbox.primer.io/payment-attempts/{id}/approve"
headers = {
"X-API-VERSION": "<x-api-version>",
"X-API-KEY": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-VERSION': '<x-api-version>', 'X-API-KEY': '<api-key>'}
};
fetch('https://api.sandbox.primer.io/payment-attempts/{id}/approve', 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.sandbox.primer.io/payment-attempts/{id}/approve",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>",
"X-API-VERSION: <x-api-version>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.primer.io/payment-attempts/{id}/approve"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("X-API-VERSION", "<x-api-version>")
req.Header.Add("X-API-KEY", "<api-key>")
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.sandbox.primer.io/payment-attempts/{id}/approve")
.header("X-API-VERSION", "<x-api-version>")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.primer.io/payment-attempts/{id}/approve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-VERSION"] = '<x-api-version>'
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"paymentAttemptId": "6c5d3a30-3c2e-4f55-9d8e-5b3d5e3a5c7f",
"paymentId": "IHQlakKC"
}
Authorizations
Headers
Specifies the version of the API to use. This must be set to 2.4.
Example:
"2.4"
Path Parameters
ID of the payment attempt to approve.