# Customers

Whenever a verification required error is returned, 3D Secure needs to be performed.

When using a private auth key to access or change a specific customer, specify the customer id of the customer you wish to update in the url. With customer auth key just specify me as the customer id.

# Create a customer

When integrating through the endpoint a customer can be initialized with Contact information and a Payment method.

# Request

 






















POST /v1/customer

Host: merchant.intergiro.com
Content-Type: application/json
Authorization: Bearer <public.api.key | private.api.key>

{
  "number": "customer-number-001",
  "method": [
    {
      "card": "<single-use.card.token>",
      "type": "token",
      "client": {
        "browser": //<Browser object>
      }
    }
  ],
  "contact": {
    "name": "Joe Smith",
    "email": "joe.smith@example.com"
  }
}

# Response

{
  "id": "SMmmIYXgLFTgE8qW",
  "number": "customer-number-001",
  "contact": {
    "name": "Joe Smith",
    "email": "joe.smith@example.com"
  },
  "method": [
    {
      "type": "card",
      "scheme": "<scheme>",
      "iin": "123456",
      "last4": "1234",
      "expires": [
        2,
        22
      ],
      "acquirer": "intergiro",
      "created": "1970-01-01T00:00:00.000Z",
      "token": "<card.token>"
    }
  ],
  "status": "active",
  "total": 0,
  "balance": [],
  "currency": "SEK"
}

# Create a customer and an order

Making a payment while creating a new customer can be done by adding an order field in the Customer Creatable.

Populate the order field with a list or a single Order Creatable but make sure to omit the fields "payment" and "customer". The items in the order you provided, or the first order in the list you provided, will be used to authorize the Payment Method.

The response will be an object containing a Customer and one or more created orders.

# Request

 

























POST /v1/customer

Host: merchant.intergiro.com
Content-Type: application/json
Authorization: Bearer <public.api.key | private.api.key>

{
  "number": "customer-number-001",
  "method": [
    {  
      "card": "<single-use.card.token>",
      "type": "token",
      "client": //<Browser object>
    }
  ],
  "contact": {
    "name": "Joe Smith",
    "email": "joe.smith@example.com"
  },
  "order": {
	  "items": 42,
	  "currency": "EUR",
    "charge": "auto"
  }
}

# Response

{
  "id": "SMmmIYXgLFTgE8qW",
  "number": "customer-number-001",
  "contact": {
    "name": "Joe Smith",
    "email": "joe.smith@example.com"
  },
  "method": [
    {
      "type": "card",
      "scheme": "<scheme>",
      "iin": "123456",
      "last4": "1234",
      "expires": [
        2,
        22
      ],
      "acquirer": "intergiro",
      "created": "1970-01-01T00:00:00.000Z",
      "token": "<card.token>"
    }
  ],
  "status": "active",
  "total": 0,
  "balance": [],
  "currency": "SEK",
  "order": "ZXlKaGJHY2lPa....."
}

# Get a customer

# Request

GET /v1/customer/:customer_id

Host: merchant.intergiro.com
Authorization: Bearer <private.api.key> | Bearer <customer.api.key>

The response will be a Customer object.


To list all Customers for current merchant, just make a GET request to the Customer endpoint.
GET /v1/customer

Merchant: merchant.intergiro.com
Authorization: Bearer <private.api.key> 

A successful response will be an array of Customer objects.

# Update contact info

To update the contact information associated to a customer make a PUT request to the following endpoint. The body of the request should be a valid Contact data type.

# Request

 




















PUT /v1/customer/:customer_id/contact

Host: merchant.intergiro.com
Content-Type: applicaiton/json
Authorization: Bearer <private.api.key> | Bearer <customer.api.key>

{
    "type": "organisation" or "person",
    "identity_number": "<identity number>",
    "id": "<your contact Id>",
    "name": "<contact name>",
    "address": {
        "street": "<street name>",
        "zip_code": "<zip code>",
        "city": "<city name>",
        "country_code": "<alpha2 country code according to ISO 3166>"
    },
    "email": "<contact email>",
    "phone": "<contact phone number>"
}

# Response

A successful response will equal the input.

# Add a payment method

A customer can have one or more cards stored as payment methods.

The body should be a Payment method creatable. The response body will be a Payment method with type card.

# Request

 












POST /v1/customer/:customer_id/method

Host: merchant.intergiro.com
Authorization: Bearer <public.api.key> | Bearer <private.api.key>

{
  "type": "token",
  "card": "<card token>",
  "client": {
    "browser": //<Browser object>
  }
}

See Browser for information on the Browser object.

# Response

{
  "type": "card",
  "scheme": "visa",
  "iin": "411111",
  "last4": "1111",
  "expires": [2, 22],
  "acquirer": "intergiro",
  "created": "2021-10-25T13:57:36.599Z",
  "token": "<card token>"
}

# Add a new payment method and create an order

Making a payment in same request when adding a new payment method can be done by adding a Payment method creatable on the field method, and (one or array of) Order Creatable on the order field. Make sure to omit the payment or contact field from the order objects.

# Request

 

















POST /v1/customer/:customer_id/method

Host: merchant.intergiro.com
Authorization: Bearer <public.api.key> | Bearer <private.api.key>

{
  "method": {
    "type": "token",
    "card": "<tokenized card information>",
    "client": // <Browser object>
    }
  },
  "order": {
    "items": <number or item information or array of items objects>,
    "currency": "<currency of the transaction>"
  }
}

# Response

{
    "method": {
      "type": "card",
      "scheme": "visa",
      "iin": "411111",
      "last4": "1111",
      "expires": [2, 22],
      "acquirer": "intergiro",
      "created": "2021-10-25T13:57:36.599Z",
      "token": "<card token>"
    },
    "order": "<signed order token>"
}

# Remove or reorder payment methods

To remove or prioritize in between payment methods for an already existing Customer,

  1. fetch the existing payment methods of the customer,
  2. without altering the objects contents, adjust the order or remove payment methods objects completely,
  3. PUT the resulting array to the same endpoint (/v1/customer/:customer_id/methods)

Example: A customer has three payment methods with following cards

  1. 400000...0000,
  2. 411111...1111,
  3. 422222...2222

Customer wants to remove card 400000...0000 and wants to prioritize card 422222...2222. Payment method list can be modified as follows and can be sent to the endpoint:

# Payment methods response before modification:

[
  {
    "type": "card",
    "scheme": "visa",
    "iin": "400000",
    "last4": "0000",
    "expires": [
      2,
      19
    ],
    "acquirer": "intergiro",
    "created": "2021-08-20T12:34:20.907Z",
    "token": "<card.token>"
  },
  {
    "type": "card",
    "scheme": "visa",
    "iin": "411111",
    "last4": "1111",
    "expires": [
      2,
      22
    ],
    "acquirer": "intergiro",
    "created": "2021-08-20T12:34:20.907Z",
    "token": "<card.token>"
  },
  {
    "type": "card",
    "scheme": "visa",
    "iin": "422222",
    "last4": "2222",
    "expires": [
      2,
      26
    ],
    "acquirer": "intergiro",
    "created": "2021-08-20T12:34:20.907Z",
    "token": "<card.token>"
  }
]

# Request with customers modification:

 

































PUT /v1/customer/:customer_id/methods

Host: merchant.intergiro.com
Authorization: Bearer <private.api.key> | Bearer <customer.api.key> 

[
  {
    "type": "card",
    "scheme": "visa",
    "iin": "422222",
    "last4": "2222",
    "expires": [
      2,
      26
    ],
    "acquirer": "intergiro",
    "created": "2021-08-20T12:34:20.907Z",
    "token": "<card.token>"
  },
  {
    "type": "card",
    "scheme": "visa",
    "iin": "411111",
    "last4": "1111",
    "expires": [
      2,
      22
    ],
    "acquirer": "intergiro",
    "created": "2021-08-20T12:34:20.907Z",
    "token": "<card.token>"
  }
]

# Response after modification:

{
  "number": "<your customer identifier>",
  "method": [
    {
      "type": "card",
      "scheme": "visa",
      "iin": "422222",
      "last4": "2222",
      "expires": [
        2,
        26
      ],
      "acquirer": "intergiro",
      "created": "2021-08-20T12:34:20.907Z",
      "token": "<card.token>"
    },
    {
      "type": "card",
      "scheme": "visa",
      "iin": "411111",
      "last4": "1111",
      "expires": [
        2,
        22
      ],
      "acquirer": "intergiro",
      "created": "2021-08-20T12:34:20.907Z",
      "token": "<card.token>"
    }
  ],
  "contact": {
    "name": "Example Customer",
    "email": "example.customer@email.com"
  },
  "status": "active",
  "total": 0,
  "balance": [],
  "currency": "SEK",
  "subscription": [
    {
      "start": "2021-08-20",
      "items": 7,
      "currency": "EUR",
      "callback": "https://your.api.com/callback",
      "id": "12aB",
      "due": "2021-08-20"
    }
  ],
  "id": "1234567890123456"
}