Payment Gateways

The Payment Gateway object

Required attributes

  • Name
    _id
    Type
    string
    Description

    The ID of the payment gateway

  • Name
    name
    Type
    string
    Description

    The display name of the payment gateway

  • Name
    secret
    Type
    string
    Description

    The secret of the payment gateway

  • Name
    sellerId
    Type
    string
    Description

    The ID of the seller that gateway belongs to

  • Name
    createdAt
    Type
    string
    Description

    An ISO timestamp indicating when the gateway was created

  • Name
    updatedAt
    Type
    string
    Description

    An ISO Timestamp indicating when the gateway was last updated

Optional attributes

  • Name
    type
    Type
    string
    Description

    The type of the gateway

  • Name
    data
    Type
    object
    Description

    Any additional data required for the integration to work

  • Name
    orgId
    Type
    string
    Description

    The ID of the organization to create this payment gateway for

  • Name
    active
    Type
    boolean
    Description

    Whether the payment gateway is active

  • Name
    redirectUrl
    Type
    string
    Description

    The URL to which the customer gets redirected

  • Name
    channels
    Type
    array<string>
    Description

    An array of channels the payment gateway is used for

  • Name
    entitlements
    Type
    object
    Description
    Required nested attributes (1)
    • Name
      target
      Type
      enum(all, selection)
      Description

      The target of the entitlement

    Optional nested attributes (1)
    • Name
      sellerIds
      Type
      array<string>
      Description

      An array of seller ids for which the gateway is active

  • Name
    capabilities
    Type
    object
    Description
    Optional nested attributes (1)
    • Name
      refunds
      Type
      object
      Description
      Optional nested attributes (2)
      • Name
        enabled
        Type
        boolean
        Description

        Whether refunds are enabled

      • Name
        endpointUrl
        Type
        string
        Description

        The endpoint URL to call in order to request a refund

  • Name
    icon
    Type
    string
    Description

    The URL of the icon of the payment gateway

  • Name
    description
    Type
    string
    Description

    A description of the payment gateway for the user

Example

{
  "_id": "507f191e810c19729de860ea",
  "name": "Example Name",
  "secret": "string",
  "sellerId": "507f191e810c19729de860ea",
  "createdAt": "2030-01-23T23:00:00.123Z",
  "updatedAt": "2030-01-23T23:00:00.123Z",
  "type": "custom",
  "data": {},
  "orgId": "507f191e810c19729de860ea",
  "active": true,
  "redirectUrl": "https://example.com",
  "channels": [
    "online"
  ],
  "entitlements": {
    "target": "all",
    "sellerIds": [
      "string"
    ]
  },
  "capabilities": {
    "refunds": {
      "enabled": true,
      "endpointUrl": "https://example.com"
    }
  },
  "icon": "string",
  "description": "string"
}
POST/api/payments/gateways

Create a Payment Gateway

Create a Payment Gateway

Payload

Required attributes

  • Name
    name
    Type
    string
    Description

    The display name of the payment gateway

Optional attributes

  • Name
    type
    Type
    string
    Description

    The type of the gateway

  • Name
    redirectUrl
    Type
    string
    Description

    The URL to which the customer gets redirected

  • Name
    data
    Type
    object
    Description

    Any additional data required for the integration to work

  • Name
    orgId
    Type
    string
    Description

    The ID of the organization to create this payment gateway for

Request

POST
/api/payments/gateways
const response = await fetch('https://vivenu.com/api/payments/gateways', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer {token}',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(  {
    "name": "Example Name",
    "type": "custom",
    "redirectUrl": "https://example.com",
    "data": {},
    "orgId": "507f191e810c19729de860ea"
  }),
})

const data = await response.json()

Response (200)

{
  "_id": "507f191e810c19729de860ea",
  "name": "Example Name",
  "secret": "string",
  "sellerId": "507f191e810c19729de860ea",
  "createdAt": "2030-01-23T23:00:00.123Z",
  "updatedAt": "2030-01-23T23:00:00.123Z",
  "type": "custom",
  "data": {},
  "orgId": "507f191e810c19729de860ea",
  "active": true,
  "redirectUrl": "https://example.com",
  "channels": [
    "online"
  ],
  "entitlements": {
    "target": "all",
    "sellerIds": [
      "string"
    ]
  },
  "capabilities": {
    "refunds": {
      "enabled": true,
      "endpointUrl": "https://example.com"
    }
  },
  "icon": "string",
  "description": "string"
}

GET/api/payments/gateways/:id

Get a Payment Gateway

Get a Payment Gateway

Request

GET
/api/payments/gateways/:id
const response = await fetch('https://vivenu.com/api/payments/gateways/507f191e810c19729de860ea', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer {token}',
  },
})

const data = await response.json()

Response (200)

{
  "_id": "507f191e810c19729de860ea",
  "name": "Example Name",
  "secret": "string",
  "sellerId": "507f191e810c19729de860ea",
  "createdAt": "2030-01-23T23:00:00.123Z",
  "updatedAt": "2030-01-23T23:00:00.123Z",
  "type": "custom",
  "data": {},
  "orgId": "507f191e810c19729de860ea",
  "active": true,
  "redirectUrl": "https://example.com",
  "channels": [
    "online"
  ],
  "entitlements": {
    "target": "all",
    "sellerIds": [
      "string"
    ]
  },
  "capabilities": {
    "refunds": {
      "enabled": true,
      "endpointUrl": "https://example.com"
    }
  },
  "icon": "string",
  "description": "string"
}

PUT/api/payments/gateways/:id

Update a Payment Gateway

Update a Payment Gateway

Payload

Required attributes

  • Name
    name
    Type
    string
    Description

    The display name of the payment gateway

Optional attributes

  • Name
    active
    Type
    boolean
    Description

    Whether the payment gateway is active

  • Name
    redirectUrl
    Type
    string
    Description

    The URL to which the customer gets redirected

  • Name
    channels
    Type
    array<string>
    Description

    An array of channels the payment gateway is used for

  • Name
    data
    Type
    object
    Description

    Any additional data required for the integration to work

  • Name
    entitlements
    Type
    object
    Description
    Required nested attributes (1)
    • Name
      target
      Type
      enum(all, selection)
      Description

      The target of the entitlement

    Optional nested attributes (1)
    • Name
      sellerIds
      Type
      array<string>
      Description

      An array of seller ids for which the gateway is active

  • Name
    capabilities
    Type
    object
    Description
    Optional nested attributes (1)
    • Name
      refunds
      Type
      object
      Description
      Optional nested attributes (2)
      • Name
        enabled
        Type
        boolean
        Description

        Whether refunds are enabled

      • Name
        endpointUrl
        Type
        string
        Description

        The endpoint URL to call in order to request a refund

  • Name
    icon
    Type
    string
    Description

    The URL of the icon of the payment gateway

  • Name
    description
    Type
    string
    Description

    A description of the payment gateway for the user

Request

PUT
/api/payments/gateways/:id
const response = await fetch('https://vivenu.com/api/payments/gateways/507f191e810c19729de860ea', {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer {token}',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(  {
    "name": "Example Name",
    "active": true,
    "redirectUrl": "https://example.com",
    "channels": [
      "online"
    ],
    "data": {},
    "entitlements": {
      "target": "all",
      "sellerIds": [
        "string"
      ]
    },
    "capabilities": {
      "refunds": {
        "enabled": true,
        "endpointUrl": "https://example.com"
      }
    },
    "icon": "string",
    "description": "string"
  }),
})

const data = await response.json()

Response (200)

{
  "_id": "507f191e810c19729de860ea",
  "name": "Example Name",
  "secret": "string",
  "sellerId": "507f191e810c19729de860ea",
  "createdAt": "2030-01-23T23:00:00.123Z",
  "updatedAt": "2030-01-23T23:00:00.123Z",
  "type": "custom",
  "data": {},
  "orgId": "507f191e810c19729de860ea",
  "active": true,
  "redirectUrl": "https://example.com",
  "channels": [
    "online"
  ],
  "entitlements": {
    "target": "all",
    "sellerIds": [
      "string"
    ]
  },
  "capabilities": {
    "refunds": {
      "enabled": true,
      "endpointUrl": "https://example.com"
    }
  },
  "icon": "string",
  "description": "string"
}

GET/api/payments/gateways

Get all Payment Gateways

Get all Payment Gateways

Query parameters

Optional query parameters

  • Name
    orgId
    Type
    anyOf
    Description
  • Name
    sellerId
    Type
    anyOf
    Description

Request

GET
/api/payments/gateways
const response = await fetch('https://vivenu.com/api/payments/gateways?orgId=507f191e810c19729de860ea&sellerId=507f191e810c19729de860ea', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer {token}',
  },
})

const data = await response.json()

Response (200)

[]

Was this page helpful?