Buyer/Supplier Relationship

A buyer and supplier have a setting for determining the default payment type used. We call this a relationship. With this, you can set the default payments type to V card, Check, ACH and lodge. If your buyer and supplier don't have a relationship, you can follow the instruction below to create one through our API.

Create Relationship

Post to https://sandbox-api.cpxenterprise.com/buyer/v1/buyer/relationship

{
  "supplierId": "xxxxxx-xxxx-xxxx-xxxx-3xxxxx7c0", //Replace with your supplier id
  "sid": "xxxxxxxxx", //Your buyer's supplier relationship Sid
  "paymentType": {
    "id": "V Card"
  },
  "buyerId": "xxxxxx-xxxxx-xxxxx-xxxxx-xxxxxx5b1d" //Replace with your buyer Id
}

Update Relationship

If your buyer and supplier already have a relationship. You can change it through this endpoint. To confirm if the change has been made you need to get the relationship's payment type.

Put to https://sandbox-api.cpxenterprise.com/buyer/v1/buyer/relationship/{relationship.id}

{
  "supplierId": "xxxxxx-xxxx-xxxx-xxxx-3xxxxx7c0", //Replace with your supplier id
  "sid": "xxxxxxxxx", //Your buyer's supplier relationship Sid
  "paymentType": {
    "id": "ACH"
  },
  "buyerId": "xxxxxx-xxxxx-xxxxx-xxxxx-xxxxxx5b1d" //Replace with your buyer Id
}

Get Relationship

Get to https://sandbox-api.cpxenterprise.com/buyer/v1/buyer/relationship?supplierId={supplier.id}&buyerId={buyer.id}

{
    "totalRecords": 1,
    "recordCount": 1,
    "records": [
        {
            "acl": [
                "pps:cpx-acquiring",
                "institution:iuju4-35b3-5358-9ij0e-6b8eiuj2df",
                "network:iuj4-d3f6-iujeae-iuj-435eaiju28d6",
                "buyer:diu5-24bc-5iuj3f-aca6-a7iuj1a521297"
            ],
            "buyer": {
                "id": "{buyer.Id}",
                "name": "Buyer Name"
            },
            "created": "2020-04-13T17:43:14.620Z",
            "creator": {
                "id": "f74wec9-48ca-50w8d-wedwed-347wedewdc9ea28",
                "username": "user+sandbox"
            },
            "deleted": false,
            "id": "13aace63-a0c5-5baf-a560-2717ef667b0a", //Relationship Id
            "modified": "2021-05-10T13:47:11.061Z",
            "modifier": {
                "id": "f74wec9-48ca-50w8d-wedwed-347wedewdc9ea28",
                 "username": "user+sandbox"
            },
            "paymentType": {
                "id": "ACH", //Relationship default payment type
                "type": "ACH"
            },
            "sid": "sid",
            "supplier": {
                "id": "{supplier.Id}",
                "name": "Supplier Name"
            }
        }
    ]
}

You can our buyer relationship API on our API reference page: https://developer.cpxchange.com/reference#relationships-2