curl --request POST \
--url https://sandbox.hyperswitch.io/routing/feedback \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"merchantId": "pro_aMoPnEkgCVnh2WVsFe32",
"gateway": "stripe:mca1",
"paymentId": "pay_1234"
}
'import requests
url = "https://sandbox.hyperswitch.io/routing/feedback"
payload = {
"merchantId": "pro_aMoPnEkgCVnh2WVsFe32",
"gateway": "stripe:mca1",
"paymentId": "pay_1234"
}
headers = {
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
merchantId: 'pro_aMoPnEkgCVnh2WVsFe32',
gateway: 'stripe:mca1',
paymentId: 'pay_1234'
})
};
fetch('https://sandbox.hyperswitch.io/routing/feedback', 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://sandbox.hyperswitch.io/routing/feedback",
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([
'merchantId' => 'pro_aMoPnEkgCVnh2WVsFe32',
'gateway' => 'stripe:mca1',
'paymentId' => 'pay_1234'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api-key: <api-key>"
],
]);
$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://sandbox.hyperswitch.io/routing/feedback"
payload := strings.NewReader("{\n \"merchantId\": \"pro_aMoPnEkgCVnh2WVsFe32\",\n \"gateway\": \"stripe:mca1\",\n \"paymentId\": \"pay_1234\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api-key", "<api-key>")
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://sandbox.hyperswitch.io/routing/feedback")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"merchantId\": \"pro_aMoPnEkgCVnh2WVsFe32\",\n \"gateway\": \"stripe:mca1\",\n \"paymentId\": \"pay_1234\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.hyperswitch.io/routing/feedback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"merchantId\": \"pro_aMoPnEkgCVnh2WVsFe32\",\n \"gateway\": \"stripe:mca1\",\n \"paymentId\": \"pay_1234\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Gateway score updated successfully"
}Routing - Feedback
Update gateway scores for dynamic routing
curl --request POST \
--url https://sandbox.hyperswitch.io/routing/feedback \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"merchantId": "pro_aMoPnEkgCVnh2WVsFe32",
"gateway": "stripe:mca1",
"paymentId": "pay_1234"
}
'import requests
url = "https://sandbox.hyperswitch.io/routing/feedback"
payload = {
"merchantId": "pro_aMoPnEkgCVnh2WVsFe32",
"gateway": "stripe:mca1",
"paymentId": "pay_1234"
}
headers = {
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
merchantId: 'pro_aMoPnEkgCVnh2WVsFe32',
gateway: 'stripe:mca1',
paymentId: 'pay_1234'
})
};
fetch('https://sandbox.hyperswitch.io/routing/feedback', 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://sandbox.hyperswitch.io/routing/feedback",
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([
'merchantId' => 'pro_aMoPnEkgCVnh2WVsFe32',
'gateway' => 'stripe:mca1',
'paymentId' => 'pay_1234'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api-key: <api-key>"
],
]);
$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://sandbox.hyperswitch.io/routing/feedback"
payload := strings.NewReader("{\n \"merchantId\": \"pro_aMoPnEkgCVnh2WVsFe32\",\n \"gateway\": \"stripe:mca1\",\n \"paymentId\": \"pay_1234\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api-key", "<api-key>")
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://sandbox.hyperswitch.io/routing/feedback")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"merchantId\": \"pro_aMoPnEkgCVnh2WVsFe32\",\n \"gateway\": \"stripe:mca1\",\n \"paymentId\": \"pay_1234\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.hyperswitch.io/routing/feedback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"merchantId\": \"pro_aMoPnEkgCVnh2WVsFe32\",\n \"gateway\": \"stripe:mca1\",\n \"paymentId\": \"pay_1234\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Gateway score updated successfully"
}Authorizations
Use the API key created under your merchant account from the HyperSwitch dashboard. API key is used to authenticate API requests from your merchant server only. Don't expose this key on a website or embed it in a mobile application.
Headers
Merchant ID of the connected merchant on whose behalf the operation is performed. Required when authenticating with a platform merchant's API key. Standard and connected merchants must not send it.
Body
Request payload to update gateway performance score based on transaction outcome
Profile ID of the merchant
"pro_aMoPnEkgCVnh2WVsFe32"
Payment Gateway identifier
"stripe:mca1"
STARTED, AUTHENTICATION_FAILED, JUSPAY_DECLINED, PENDING_VBV, V_B_V_SUCCESSFUL, AUTHORIZED, AUTHORIZATION_FAILED, CHARGED, AUTHORIZING, C_O_D_INITIATED, VOIDED, VOIDED_POST_CHARGE, VOID_INITIATED, NOP, CAPTURE_INITIATED, CAPTURE_FAILED, VOID_FAILED, AUTO_REFUNDED, PARTIAL_CHARGED, TO_BE_CHARGED, PENDING, FAILURE, DECLINED Payment ID associated with the transaction
"pay_1234"
Response
Gateway score updated successfully
Response after updating gateway score
Status message indicating the result of the score update
"Gateway score updated successfully"
Was this page helpful?