Retrieve the chargebacks initiated for a specific payment.
The results are paginated.
package main
import(
"context"
"os"
"github.com/mollie/mollie-api-golang/models/components"
client "github.com/mollie/mollie-api-golang"
"github.com/mollie/mollie-api-golang/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := client.New(
client.WithTestmode(false),
client.WithSecurity(components.Security{
APIKey: client.Pointer(os.Getenv("CLIENT_API_KEY")),
}),
)
res, err := s.Chargebacks.List(ctx, operations.ListChargebacksRequest{
PaymentID: "tr_5B8cwPMGnU",
From: client.Pointer("chb_xFzwUN4ci8HAmSGUACS4J"),
Limit: client.Pointer[int64](50),
Embed: client.Pointer("payment"),
IdempotencyKey: client.Pointer("123e4567-e89b-12d3-a456-426"),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}package main
import(
"context"
"os"
"github.com/mollie/mollie-api-golang/models/components"
client "github.com/mollie/mollie-api-golang"
"github.com/mollie/mollie-api-golang/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := client.New(
client.WithTestmode(false),
client.WithSecurity(components.Security{
APIKey: client.Pointer(os.Getenv("CLIENT_API_KEY")),
}),
)
res, err := s.Chargebacks.List(ctx, operations.ListChargebacksRequest{
PaymentID: "tr_5B8cwPMGnU",
From: client.Pointer("chb_xFzwUN4ci8HAmSGUACS4J"),
Limit: client.Pointer[int64](50),
Embed: client.Pointer("payment"),
IdempotencyKey: client.Pointer("123e4567-e89b-12d3-a456-426"),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}package main
import(
"context"
"os"
"github.com/mollie/mollie-api-golang/models/components"
client "github.com/mollie/mollie-api-golang"
"github.com/mollie/mollie-api-golang/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := client.New(
client.WithTestmode(false),
client.WithSecurity(components.Security{
APIKey: client.Pointer(os.Getenv("CLIENT_API_KEY")),
}),
)
res, err := s.Chargebacks.List(ctx, operations.ListChargebacksRequest{
PaymentID: "tr_5B8cwPMGnU",
From: client.Pointer("chb_xFzwUN4ci8HAmSGUACS4J"),
Limit: client.Pointer[int64](50),
Embed: client.Pointer("payment"),
IdempotencyKey: client.Pointer("123e4567-e89b-12d3-a456-426"),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.ListChargebacksRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.ListChargebacksResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.ErrorResponse | 400, 404 | application/hal+json |
| apierrors.APIError | 4XX, 5XX | */* |
Retrieve a single payment chargeback by its ID and the ID of its parent payment.
package main
import(
"context"
"os"
"github.com/mollie/mollie-api-golang/models/components"
client "github.com/mollie/mollie-api-golang"
"github.com/mollie/mollie-api-golang/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := client.New(
client.WithTestmode(false),
client.WithSecurity(components.Security{
APIKey: client.Pointer(os.Getenv("CLIENT_API_KEY")),
}),
)
res, err := s.Chargebacks.Get(ctx, operations.GetChargebackRequest{
PaymentID: "tr_5B8cwPMGnU",
ChargebackID: "chb_xFzwUN4ci8HAmSGUACS4J",
Embed: client.Pointer("payment"),
IdempotencyKey: client.Pointer("123e4567-e89b-12d3-a456-426"),
})
if err != nil {
log.Fatal(err)
}
if res.EntityChargeback != nil {
// handle response
}
}package main
import(
"context"
"os"
"github.com/mollie/mollie-api-golang/models/components"
client "github.com/mollie/mollie-api-golang"
"github.com/mollie/mollie-api-golang/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := client.New(
client.WithTestmode(false),
client.WithSecurity(components.Security{
APIKey: client.Pointer(os.Getenv("CLIENT_API_KEY")),
}),
)
res, err := s.Chargebacks.Get(ctx, operations.GetChargebackRequest{
PaymentID: "tr_5B8cwPMGnU",
ChargebackID: "chb_xFzwUN4ci8HAmSGUACS4J",
Embed: client.Pointer("payment"),
IdempotencyKey: client.Pointer("123e4567-e89b-12d3-a456-426"),
})
if err != nil {
log.Fatal(err)
}
if res.EntityChargeback != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetChargebackRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetChargebackResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.ErrorResponse | 404 | application/hal+json |
| apierrors.APIError | 4XX, 5XX | */* |
Retrieve all chargebacks initiated for all your payments.
The results are paginated.
package main
import(
"context"
"os"
"github.com/mollie/mollie-api-golang/models/components"
client "github.com/mollie/mollie-api-golang"
"github.com/mollie/mollie-api-golang/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := client.New(
client.WithProfileID("pfl_5B8cwPMGnU"),
client.WithTestmode(false),
client.WithSecurity(components.Security{
APIKey: client.Pointer(os.Getenv("CLIENT_API_KEY")),
}),
)
res, err := s.Chargebacks.All(ctx, operations.ListAllChargebacksRequest{
From: client.Pointer("chb_xFzwUN4ci8HAmSGUACS4J"),
Limit: client.Pointer[int64](50),
Embed: client.Pointer("payment"),
Sort: components.SortingDesc.ToPointer(),
IdempotencyKey: client.Pointer("123e4567-e89b-12d3-a456-426"),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}package main
import(
"context"
"os"
"github.com/mollie/mollie-api-golang/models/components"
client "github.com/mollie/mollie-api-golang"
"github.com/mollie/mollie-api-golang/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := client.New(
client.WithProfileID("pfl_5B8cwPMGnU"),
client.WithTestmode(false),
client.WithSecurity(components.Security{
APIKey: client.Pointer(os.Getenv("CLIENT_API_KEY")),
}),
)
res, err := s.Chargebacks.All(ctx, operations.ListAllChargebacksRequest{
From: client.Pointer("chb_xFzwUN4ci8HAmSGUACS4J"),
Limit: client.Pointer[int64](50),
Embed: client.Pointer("payment"),
Sort: components.SortingDesc.ToPointer(),
IdempotencyKey: client.Pointer("123e4567-e89b-12d3-a456-426"),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}package main
import(
"context"
"os"
"github.com/mollie/mollie-api-golang/models/components"
client "github.com/mollie/mollie-api-golang"
"github.com/mollie/mollie-api-golang/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := client.New(
client.WithProfileID("pfl_5B8cwPMGnU"),
client.WithTestmode(false),
client.WithSecurity(components.Security{
APIKey: client.Pointer(os.Getenv("CLIENT_API_KEY")),
}),
)
res, err := s.Chargebacks.All(ctx, operations.ListAllChargebacksRequest{
From: client.Pointer("chb_xFzwUN4ci8HAmSGUACS4J"),
Limit: client.Pointer[int64](50),
Embed: client.Pointer("payment"),
Sort: components.SortingDesc.ToPointer(),
IdempotencyKey: client.Pointer("123e4567-e89b-12d3-a456-426"),
})
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.ListAllChargebacksRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.ListAllChargebacksResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.ErrorResponse | 400, 404 | application/hal+json |
| apierrors.APIError | 4XX, 5XX | */* |