Refunds
List Refunds
List refunds.
Scopes: refunds:read refunds:write
GET
/
v1
/
refunds
/
Go (SDK)
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.Refunds.List(ctx, operations.RefundsListRequest{
OrganizationID: polargo.Pointer(operations.CreateRefundsListQueryParamOrganizationIDFilterStr(
"1dbfc517-0bbf-4301-9ba8-555ca42b9737",
)),
})
if err != nil {
log.Fatal(err)
}
if res.ListResourceRefund != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.refunds.list(organization_id="1dbfc517-0bbf-4301-9ba8-555ca42b9737", page=1, limit=10)
while res is not None:
# Handle items
res = res.next()import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.refunds.list({
organizationId: "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
});
for await (const page of result) {
console.log(page);
}
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Operations;
$sdk = Polar\Polar::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$request = new Operations\RefundsListRequest(
organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',
);
$responses = $sdk->refunds->list(
request: $request
);
foreach ($responses as $response) {
if ($response->statusCode === 200) {
// handle response
}
}curl --request GET \
--url https://api.polar.sh/v1/refunds/ \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.polar.sh/v1/refunds/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api.polar.sh/v1/refunds/")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/refunds/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"items": [
{
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"metadata": {},
"amount": 123,
"tax_amount": 123,
"currency": "<string>",
"organization_id": "<string>",
"order_id": "<string>",
"subscription_id": "<string>",
"customer_id": "<string>",
"revoke_benefits": true,
"dispute": {
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"resolved": true,
"closed": true,
"amount": 123,
"tax_amount": 123,
"currency": "<string>",
"order_id": "<string>",
"payment_id": "<string>"
}
}
],
"pagination": {
"total_count": 123,
"max_page": 123
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
You can generate an Organization Access Token from your organization's settings.
Query Parameters
Filter by refund ID. The refund ID.
Filter by organization ID. The organization ID.
Example:
"1dbfc517-0bbf-4301-9ba8-555ca42b9737"
Filter by order ID. The order ID.
Filter by subscription ID. The subscription ID.
Filter by customer ID. The customer ID.
Filter by customer external ID. The customer external ID.
Filter by succeeded.
Page number, defaults to 1.
Size of a page, defaults to 10. Maximum is 100.
Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign - before the criteria name to sort by descending order.
Available options:
created_at, -created_at, amount, -amount Was this page helpful?
⌘I
Go (SDK)
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"github.com/polarsource/polar-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.Refunds.List(ctx, operations.RefundsListRequest{
OrganizationID: polargo.Pointer(operations.CreateRefundsListQueryParamOrganizationIDFilterStr(
"1dbfc517-0bbf-4301-9ba8-555ca42b9737",
)),
})
if err != nil {
log.Fatal(err)
}
if res.ListResourceRefund != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.refunds.list(organization_id="1dbfc517-0bbf-4301-9ba8-555ca42b9737", page=1, limit=10)
while res is not None:
# Handle items
res = res.next()import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.refunds.list({
organizationId: "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
});
for await (const page of result) {
console.log(page);
}
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Operations;
$sdk = Polar\Polar::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$request = new Operations\RefundsListRequest(
organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',
);
$responses = $sdk->refunds->list(
request: $request
);
foreach ($responses as $response) {
if ($response->statusCode === 200) {
// handle response
}
}curl --request GET \
--url https://api.polar.sh/v1/refunds/ \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.polar.sh/v1/refunds/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api.polar.sh/v1/refunds/")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/refunds/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"items": [
{
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"metadata": {},
"amount": 123,
"tax_amount": 123,
"currency": "<string>",
"organization_id": "<string>",
"order_id": "<string>",
"subscription_id": "<string>",
"customer_id": "<string>",
"revoke_benefits": true,
"dispute": {
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"resolved": true,
"closed": true,
"amount": 123,
"tax_amount": 123,
"currency": "<string>",
"order_id": "<string>",
"payment_id": "<string>"
}
}
],
"pagination": {
"total_count": 123,
"max_page": 123
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}
