Skip to content

Latest commit

 

History

History
310 lines (220 loc) · 10 KB

CustomersApi.md

File metadata and controls

310 lines (220 loc) · 10 KB

SumUpRestApi.CustomersApi

All URIs are relative to https://api.sumup.com/{version}

Method HTTP request Description
customersCustomerIdGet GET /customers/{customer_id} Retrieve a customer
customersCustomerIdPaymentInstrumentsGet GET /customers/{customer_id}/payment-instruments List payment instruments
customersCustomerIdPaymentInstrumentsPost POST /customers/{customer_id}/payment-instruments Create a payment instrument
customersCustomerIdPaymentInstrumentsTokenDelete DELETE /customers/{customer_id}/payment-instruments/{token} Deactivate a payment instrument
customersCustomerIdPut PUT /customers/{customer_id} Update a customer
customersPost POST /customers Create a customer

customersCustomerIdGet

CustomerResponse customersCustomerIdGet(customerId)

Retrieve a customer

Retrieves an identified saved customer resource through the unique `customer_id` parameter, generated upon customer creation.

Example

import {SumUpRestApi} from 'sumup-rest-api';
let defaultClient = SumUpRestApi.ApiClient.instance;

// Configure OAuth2 access token for authorization: accessToken
let accessToken = defaultClient.authentications['accessToken'];
accessToken.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new SumUpRestApi.CustomersApi();
let customerId = "customerId_example"; // String | Unique ID of the saved customer resource.

apiInstance.customersCustomerIdGet(customerId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
customerId String Unique ID of the saved customer resource.

Return type

CustomerResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

customersCustomerIdPaymentInstrumentsGet

[PaymentInstrumentResponse] customersCustomerIdPaymentInstrumentsGet(customerId)

List payment instruments

Lists all payment instrument resources that are saved for an identified customer.

Example

import {SumUpRestApi} from 'sumup-rest-api';
let defaultClient = SumUpRestApi.ApiClient.instance;

// Configure OAuth2 access token for authorization: accessToken
let accessToken = defaultClient.authentications['accessToken'];
accessToken.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new SumUpRestApi.CustomersApi();
let customerId = "customerId_example"; // String | Unique ID of the saved customer resource.

apiInstance.customersCustomerIdPaymentInstrumentsGet(customerId, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
customerId String Unique ID of the saved customer resource.

Return type

[PaymentInstrumentResponse]

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

customersCustomerIdPaymentInstrumentsPost

PaymentInstrumentResponse customersCustomerIdPaymentInstrumentsPost(customerId, opts)

Create a payment instrument

Creates and activates a new payment instrument resource by saving a payment card for an identified customer. Implement to improve customer experience by skipping the step of entering payment instrument details. The token created via this endpoint <b>can not</b> be used for recurring payments by merchants operating within the EU. For more information visit our <a href=&quot;https://developer.sumup.com/docs/recurring-payments/\" target=&quot;_blank&quot;>recurring payments guide</a>.

Example

import {SumUpRestApi} from 'sumup-rest-api';
let defaultClient = SumUpRestApi.ApiClient.instance;

// Configure OAuth2 access token for authorization: accessToken
let accessToken = defaultClient.authentications['accessToken'];
accessToken.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new SumUpRestApi.CustomersApi();
let customerId = "customerId_example"; // String | Unique ID of the saved customer resource.
let opts = { 
  'body': new SumUpRestApi.PaymentInstrumentCard() // PaymentInstrumentCard | 
};
apiInstance.customersCustomerIdPaymentInstrumentsPost(customerId, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
customerId String Unique ID of the saved customer resource.
body PaymentInstrumentCard [optional]

Return type

PaymentInstrumentResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

customersCustomerIdPaymentInstrumentsTokenDelete

customersCustomerIdPaymentInstrumentsTokenDelete(customerId, token)

Deactivate a payment instrument

Deactivates an identified card payment instrument resource for a customer.

Example

import {SumUpRestApi} from 'sumup-rest-api';
let defaultClient = SumUpRestApi.ApiClient.instance;

// Configure OAuth2 access token for authorization: accessToken
let accessToken = defaultClient.authentications['accessToken'];
accessToken.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new SumUpRestApi.CustomersApi();
let customerId = "customerId_example"; // String | Unique ID of the saved customer resource.
let token = "token_example"; // String | Unique token identifying the card saved as a payment instrument resource.

apiInstance.customersCustomerIdPaymentInstrumentsTokenDelete(customerId, token, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
});

Parameters

Name Type Description Notes
customerId String Unique ID of the saved customer resource.
token String Unique token identifying the card saved as a payment instrument resource.

Return type

null (empty response body)

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

customersCustomerIdPut

CustomerResponse customersCustomerIdPut(customerId, opts)

Update a customer

Updates an identified saved customer resource's personal details. The request only overwrites the parameters included in the request, all other parameters will remain with their initially assigned values.

Example

import {SumUpRestApi} from 'sumup-rest-api';
let defaultClient = SumUpRestApi.ApiClient.instance;

// Configure OAuth2 access token for authorization: accessToken
let accessToken = defaultClient.authentications['accessToken'];
accessToken.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new SumUpRestApi.CustomersApi();
let customerId = "customerId_example"; // String | Unique ID of the saved customer resource.
let opts = { 
  'body': null // Object | 
};
apiInstance.customersCustomerIdPut(customerId, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
customerId String Unique ID of the saved customer resource.
body Object [optional]

Return type

CustomerResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

customersPost

CustomerResponse customersPost(opts)

Create a customer

Creates a new saved customer resource which you can later manipulate and save payment instruments to.

Example

import {SumUpRestApi} from 'sumup-rest-api';
let defaultClient = SumUpRestApi.ApiClient.instance;

// Configure OAuth2 access token for authorization: accessToken
let accessToken = defaultClient.authentications['accessToken'];
accessToken.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new SumUpRestApi.CustomersApi();
let opts = { 
  'body': new SumUpRestApi.Customer() // Customer | Details of the customer.
};
apiInstance.customersPost(opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
body Customer Details of the customer. [optional]

Return type

CustomerResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json