Refund a charge
curl --request POST \
--url https://api.salesive.com/api/v1/app-billing/charges/{id}/refunds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 5,
"reason": "Charged twice for the same seats",
"idempotencyKey": "refund-A-1042"
}
'import requests
url = "https://api.salesive.com/api/v1/app-billing/charges/{id}/refunds"
payload = {
"amount": 5,
"reason": "Charged twice for the same seats",
"idempotencyKey": "refund-A-1042"
}
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({
amount: 5,
reason: 'Charged twice for the same seats',
idempotencyKey: 'refund-A-1042'
})
};
fetch('https://api.salesive.com/api/v1/app-billing/charges/{id}/refunds', 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.salesive.com/api/v1/app-billing/charges/{id}/refunds",
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([
'amount' => 5,
'reason' => 'Charged twice for the same seats',
'idempotencyKey' => 'refund-A-1042'
]),
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.salesive.com/api/v1/app-billing/charges/{id}/refunds"
payload := strings.NewReader("{\n \"amount\": 5,\n \"reason\": \"Charged twice for the same seats\",\n \"idempotencyKey\": \"refund-A-1042\"\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.salesive.com/api/v1/app-billing/charges/{id}/refunds")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 5,\n \"reason\": \"Charged twice for the same seats\",\n \"idempotencyKey\": \"refund-A-1042\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesive.com/api/v1/app-billing/charges/{id}/refunds")
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 \"amount\": 5,\n \"reason\": \"Charged twice for the same seats\",\n \"idempotencyKey\": \"refund-A-1042\"\n}"
response = http.request(request)
puts response.read_body{
"status": 123,
"success": true,
"message": "<string>",
"data": {
"id": "<string>",
"reference": "<string>",
"chargeId": "<string>",
"status": "reserving",
"amount": 123,
"currency": "USD",
"platformFeeReturned": 123,
"netAmountReturned": 123,
"merchantAmount": 123,
"merchantCurrency": "<string>",
"reason": "<string>",
"by": "app",
"test": true,
"failureReason": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z"
}
}{
"status": 401,
"success": false,
"message": "Authentication required",
"data": null
}{
"status": 403,
"success": false,
"message": "Insufficient scope",
"data": null
}{
"status": 404,
"success": false,
"message": "Resource not found",
"data": null
}Billing
Refund a charge
Refund all or part of a paid charge to the merchant’s wallet. Requires the WRITE_CHARGES scope.
POST
/
app-billing
/
charges
/
{id}
/
refunds
Refund a charge
curl --request POST \
--url https://api.salesive.com/api/v1/app-billing/charges/{id}/refunds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 5,
"reason": "Charged twice for the same seats",
"idempotencyKey": "refund-A-1042"
}
'import requests
url = "https://api.salesive.com/api/v1/app-billing/charges/{id}/refunds"
payload = {
"amount": 5,
"reason": "Charged twice for the same seats",
"idempotencyKey": "refund-A-1042"
}
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({
amount: 5,
reason: 'Charged twice for the same seats',
idempotencyKey: 'refund-A-1042'
})
};
fetch('https://api.salesive.com/api/v1/app-billing/charges/{id}/refunds', 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.salesive.com/api/v1/app-billing/charges/{id}/refunds",
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([
'amount' => 5,
'reason' => 'Charged twice for the same seats',
'idempotencyKey' => 'refund-A-1042'
]),
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.salesive.com/api/v1/app-billing/charges/{id}/refunds"
payload := strings.NewReader("{\n \"amount\": 5,\n \"reason\": \"Charged twice for the same seats\",\n \"idempotencyKey\": \"refund-A-1042\"\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.salesive.com/api/v1/app-billing/charges/{id}/refunds")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 5,\n \"reason\": \"Charged twice for the same seats\",\n \"idempotencyKey\": \"refund-A-1042\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.salesive.com/api/v1/app-billing/charges/{id}/refunds")
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 \"amount\": 5,\n \"reason\": \"Charged twice for the same seats\",\n \"idempotencyKey\": \"refund-A-1042\"\n}"
response = http.request(request)
puts response.read_body{
"status": 123,
"success": true,
"message": "<string>",
"data": {
"id": "<string>",
"reference": "<string>",
"chargeId": "<string>",
"status": "reserving",
"amount": 123,
"currency": "USD",
"platformFeeReturned": 123,
"netAmountReturned": 123,
"merchantAmount": 123,
"merchantCurrency": "<string>",
"reason": "<string>",
"by": "app",
"test": true,
"failureReason": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z"
}
}{
"status": 401,
"success": false,
"message": "Authentication required",
"data": null
}{
"status": 403,
"success": false,
"message": "Insufficient scope",
"data": null
}{
"status": 404,
"success": false,
"message": "Resource not found",
"data": null
}Refunds a paid charge, in full or in part, to the merchant’s wallet. Your payout wallet gives back the same share of what it received. See Refunds.
Authorizations
Installed-app access token (prefix app_), issued by the OAuth install flow. The store is bound to the token server-side, never send a shop id.
Path Parameters
The charge id.
Body
application/json
Response
A refund with this idempotencyKey already exists; it is returned.
Was this page helpful?

