Skip to main content
PATCH
/
api
/
v1
/
agreements
Cancel agreements
curl --request PATCH \
  --url https://demo.api.loopcrypto.xyz/api/v1/agreements \
  --header 'Content-Type: application/json' \
  --header 'api-key: <api-key>' \
  --header 'entity-id: <api-key>' \
  --data '{
  "agreementIds": [
    "83aac889-da5b-4432-ac51-b05cf3ae2aac"
  ],
  "cancellationReason": "No longer need the service"
}'
{
  "agreements": [
    {
      "agreementId": "83aac889-da5b-4432-ac51-b05cf3ae2aac",
      "walletAddress": "0x56be8cpbed39582aad0eaa6e8f2adb109152fb6c",
      "networkId": 137,
      "email": "testing@example.xyz",
      "entityId": "911492f7-688d-11ed-9618-06613fde562",
      "token": "0x07865c6E87B9F70255377e024ace6630C1Eaa37F",
      "itemId": "8199041b-a8c2-40ae-b90d-633d3eb59111",
      "startDate": 1672423318,
      "status": 2,
      "cancelledAt": 1672761102,
      "cancellationEffectiveDate": 1672761534,
      "cancellationReason": "Cancelled by entity",
      "refId": "user-42",
      "discountPercent": 42,
      "externalId": "sub_1ObTC0EsKlmFX3FHDjZnmim1",
      "externalReferenceId": "mySpecialReference",
      "cancellationSource": 3,
      "allowCancel": true,
      "allowResubscribe": true,
      "paymentMethod": {
        "paymentMethodId": "1234567890abcdef",
        "merchantId": "67e55044-10b1-426f-9247-bb680e5fe0c8",
        "paymentMethodName": "My Crypto Wallet",
        "active": true,
        "customer": {
          "customerId": "1234567890abcdef",
          "customerRefId": "1234567890abcdef"
        },
        "networkId": 1,
        "walletAddress": "0x1234567890abcdef",
        "isDefault": true,
        "token": {
          "symbol": "USDC",
          "tokenId": "123e4567-e89b-12d3-a456-426614174000",
          "address": "0x1234567890abcdef",
          "decimals": 6,
          "exchangeRates": [
            {
              "currency": "USD",
              "price": "10000",
              "provider": "CoinMarketCap",
              "timestamp": 1715731200
            }
          ]
        },
        "preAuthorization": {
          "balance": "100",
          "authorization": "49.9"
        },
        "dateCreated": 1716211200
      }
    }
  ]
}

Authorizations

api-key
string
header
required
entity-id
string
header
required

Body

application/json
agreementIds
string[]
required

This unique code represents the wallet / item association of the agreements to cancel

Example:
["83aac889-da5b-4432-ac51-b05cf3ae2aac"]
cancellationReason
string

(Optional) Reason for the cancellation. If not provided, the default reason will be "Cancelled by entity"

Example:

"No longer need the service"

Response

Ok

To get agreementIDs, you can use the “get agreements” endpoint to query all the wallets that have authorized your contract and their associated items.

agreements
object[]
required

A list of the returned agreements based on the request

I