Initiate Refund
curl --request POST \
--url https://api.appcharge.com/checkout/api/v1/order/{orderId}/refund \
--header 'x-publisher-token: <x-publisher-token>' \
--header 'x-user-id: <x-user-id>'import requests
url = "https://api.appcharge.com/checkout/api/v1/order/{orderId}/refund"
headers = {
"x-publisher-token": "<x-publisher-token>",
"x-user-id": "<x-user-id>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-publisher-token': '<x-publisher-token>', 'x-user-id': '<x-user-id>'}
};
fetch('https://api.appcharge.com/checkout/api/v1/order/{orderId}/refund', 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.appcharge.com/checkout/api/v1/order/{orderId}/refund",
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-publisher-token: <x-publisher-token>",
"x-user-id: <x-user-id>"
],
]);
$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.appcharge.com/checkout/api/v1/order/{orderId}/refund"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-publisher-token", "<x-publisher-token>")
req.Header.Add("x-user-id", "<x-user-id>")
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.appcharge.com/checkout/api/v1/order/{orderId}/refund")
.header("x-publisher-token", "<x-publisher-token>")
.header("x-user-id", "<x-user-id>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.appcharge.com/checkout/api/v1/order/{orderId}/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-publisher-token"] = '<x-publisher-token>'
request["x-user-id"] = '<x-user-id>'
response = http.request(request)
puts response.read_body{}{
"result": null,
"errCode": -1,
"message": "Forbidden resource"
}{
"message": "Order does not exist or cannot be found."
}{
"message": "Failed to initiate a refund request"
}Refunds
Initiate Refund
Initiates a full refund for a specified order.
Once the API call is successful, the refund process begins. The result of the refund, whether it succeeds or fails, is communicated asynchronously when the order status updates to Refunded or Refund Failed. You can track the order status in the Orders tab of the Publisher Dashboard.
If the refund is completed successfully, the total order amount is reimbursed, and the Order Refunded event is triggered.
Note: This action is final and can’t be undone.
POST
/
checkout
/
api
/
v1
/
order
/
{orderId}
/
refund
Initiate Refund
curl --request POST \
--url https://api.appcharge.com/checkout/api/v1/order/{orderId}/refund \
--header 'x-publisher-token: <x-publisher-token>' \
--header 'x-user-id: <x-user-id>'import requests
url = "https://api.appcharge.com/checkout/api/v1/order/{orderId}/refund"
headers = {
"x-publisher-token": "<x-publisher-token>",
"x-user-id": "<x-user-id>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-publisher-token': '<x-publisher-token>', 'x-user-id': '<x-user-id>'}
};
fetch('https://api.appcharge.com/checkout/api/v1/order/{orderId}/refund', 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.appcharge.com/checkout/api/v1/order/{orderId}/refund",
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-publisher-token: <x-publisher-token>",
"x-user-id: <x-user-id>"
],
]);
$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.appcharge.com/checkout/api/v1/order/{orderId}/refund"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-publisher-token", "<x-publisher-token>")
req.Header.Add("x-user-id", "<x-user-id>")
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.appcharge.com/checkout/api/v1/order/{orderId}/refund")
.header("x-publisher-token", "<x-publisher-token>")
.header("x-user-id", "<x-user-id>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.appcharge.com/checkout/api/v1/order/{orderId}/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-publisher-token"] = '<x-publisher-token>'
request["x-user-id"] = '<x-user-id>'
response = http.request(request)
puts response.read_body{}{
"result": null,
"errCode": -1,
"message": "Forbidden resource"
}{
"message": "Order does not exist or cannot be found."
}{
"message": "Failed to initiate a refund request"
}Was this page helpful?
⌘I
