Skip to content
On this page

The Swap Object

AttributeDescription
_idID of the swap. Unavailable when the status.type is pending.
statusStatus of the swap.
authAuth object related to the swap.
companyCompany object related to the swap.
paymentMethodPayment method object to be swapped in.

Example Response

json
{
  "_id": "5b4cdadf8ea75a6602ff82bb",
  "status": {
    "type": "completed"
  },
  "auth": {
    "_id": "5b4cdade36c0c10108a57405",
    "status": {
      "type": "verified"
    }
  },
  "company": {
    "_id": "5522f59264f5785929aa1c42",
    "name": "Hulu",
    "status": "operational",
    "logo": {
      "url": "https://s3.amazonaws.com/app-assets.unbill.io-primary/uploads/utility-provider-logos/a3c89f48378c84713fb31ce0e97bfa15.png",
      "background": false
    }
  },
  "paymentMethod": {
    "_id": "5b296e67a15d4e0001174fc2",
    "type": "card",
    "name": "Demo User",
    "status": "verified",
    "default": true,
    "card": {
      "number": "XXXX7989",
      "bin": "41474002",
      "brand": "visa",
      "type": "credit",
      "expDate": "2023-06-01T12:00:00.000Z"
    }
  }
}

Swap Statuses

A swap status.type indicates the current state of a request to swap a payment method with a particular company.

in-progress

The swap of the payment method is currently in progress.

For Testing set status to in-progress.

In Progress Response

json
{
  "status": {
    "type": "in-progress"
  }
}

hold

The swap of the payment method is currently on hold as described in the Auth Status.

For Testing refer to auth hold.

Hold Response

json
{
  "status": {
    "type": "hold"
  }
}

completed

The swap of the payment method has been completed successfully.

For Testing set status to completed.

Completed Response

json
{
  "status": {
    "type": "completed"
  }
}

card-on-file

The swap of the payment method has been completed with the detection that the card was already on file.

For Testing set status to card-on-file.

Card On File Response

json
{
  "status": {
    "type": "card-on-file"
  }
}