Skip to content

Disputes

Disputes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
  "id": "dspt_kkyLpFvqM8JYQrBJlhN9bxSY",
  "payment": "paym_oTwazegPIbxPnUWDntboWvyL",
  "amount": 5247,
  "currency": "eur",
  "response": "45",
  "order_id": "825030405",
  "created": 1540504800,
  "live_mode": true
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
package Stancer::Dispute;

use Moo;
use Stancer::Core::Types qw(:all);

has amount => (is => 'ro', isa => Int);

has created => (is => 'ro', isa => InstanceOf['DateTime']);

has currency => (is => 'ro', isa => Enum['EUR', 'GBP', 'USD']);

has id => (is => 'ro', isa => Char[29]);

has order_id => (is => 'ro', isa => Varchar[1, 24]);

has payment => (is => 'ro', isa => InstanceOf['Stancer::Payment']);

has response => (is => 'ro', isa => Varchar[2, 4]);

1;
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<?php
namespace Stancer;

use DateTime;

class Dispute
{
  protected int $amount;
  protected DateTime $created;
  protected string $currency;
  protected string $id;
  protected ?string $orderId;
  protected Payment $payment;
  protected string $response;

  public function __construct(string $id = null) {}
}
1
Not available for the moment

The dispute object is defined as follows:

Parameter Description Type
id Dispute's id String, fixed size = 29
payment Related payment's id String, fixed size = 29
amount Disputed amount Int
currency Currency of the disputed amount Enum EUR, USD, GPB
response Response code description See Payment response codes
order_id The order_id you specified in your inital payment request String
created Creation's timestamp of the dispute Int
live_mode Whatever if the refund is in live mode Boolean

Get dispute data

HTTP request

/v1/disputes/
id_dispute

Query parameters

Parameter Field
id_dispute Required

Return parameters

The request returns a dispute object as previously defined.

Code Examples

1
curl "https://api.stancer.com/v1/disputes/<id_dispute>"
1
2
3
4
#! /bin/perl -w
use Stancer::Dispute;

my $dispute = Stancer::Dispute->new('dspt_kkyLpFvqM8JYQrBJlhN9bxSY');
1
2
<?php
$dispute = new Stancer\Dispute('dspt_kkyLpFvqM8JYQrBJlhN9bxSY');
1
Not available for the moment

The above command returns JSON structured as follows:

1
2
3
4
5
6
7
8
9
{
  "amount": 5247,
  "created": 1540504800,
  "id": "dspt_kkyLpFvqM8JYQrBJlhN9bxSY",
  "order_id": "825030405",
  "payment": "paym_oTwazegPIbxPnUWDntboWvyL",
  "response": "45",
  "live_mode": true
}

List all disputes

HTTP request

/v1/disputes/
?created=
created
?start=
start
?limit=
limit

Query parameters

Parameter Field Description Type
created Optional A Unix timestamp filtering disputes whom timestamp are equal to or greater Int
limit Optional An integer value limiting the number of objects to be returned Int, min = 1 max = 100, default = 10
start Optional An integer cursor you can use for pagination starting at index 0 Int, default = 0

Return parameters

Parameter Description
disputes An array of dispute objects
live_mode Whatever if you are in live mode
range Details of your request and pagination. If has_more is true, you will need to move the start cursor ahead to fetch more objects

Code Examples

1
curl "https://api.stancer.com/v1/disputes/?start=0&limit=2"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#! /bin/perl -w
use Stancer::Dispute;

my $list = Stancer::Dispute->list({created => 1_540_504_800, limit => 2});

while (my $dispute = $list->next()) {
  # Do some stuff with $dispute
}

# `list` method allow `hash` or `hashref`.
# `created` allow `integer` or a `DateTime` instance.
1
2
3
4
5
6
7
8
9
<?php
$date = new DateTime('@1540504800');

foreach (Stancer\Dispute::list([created => $date, limit => 2]) as $dispute) {
  // Do some stuff with $dispute
}

// `list` method return a generator.
// `created` allow `integer` or a `DateTime` instance.
1
Not available for the moment

The above command returns JSON structured as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
  "disputes": [
    {
      "amount": 5247,
      "created": 1540504800,
      "id": "dspt_kkyLpFvqM8JYQrBJlhN9bxSY",
      "order_id": "825030405",
      "payment": "paym_oTwazegPIbxPnUWDntboWvyL",
      "response": "45"
    },
    {
      "amount": 2999,
      "created": 1541372400,
      "id": "dspt_VIk2SufjagxqT6ZtoRbqUkUm",
      "order_id": "825198976",
      "payment": "paym_oArnefSPklDJ6pEFdxIF6QkG",
      "response": "45"
    }
  ],
  "live_mode": true,
  "range": {
    "end": 1,
    "has_more": true,
    "limit": 2,
    "start": 0
  }
}