# Charges

## Charge resource

{% hint style="info" %}
**Note**: Since cryptocurrency payments are push payments, a charge will expire after a waiting period (payment window) if no payment has been detected. Charges are identified by a unique code.
{% endhint %}

#### Fields

| FIELD                   | TYPE         | DESCRIPTION                                                                                                                                                                                                                                                                                                                                                           |
| ----------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id                      | string       | Charge id                                                                                                                                                                                                                                                                                                                                                             |
| transactionType         | string       | Enum value. One of `EXTERNAL, PRODUCT_CHECKOUT, INVOICE`                                                                                                                                                                                                                                                                                                              |
| amountReceived          | Object       | List of payments of this charge.                                                                                                                                                                                                                                                                                                                                      |
| merchantId              | string       | Id of owner/creator                                                                                                                                                                                                                                                                                                                                                   |
| name                    | string       | Charge name                                                                                                                                                                                                                                                                                                                                                           |
| description             | string       | Charge description                                                                                                                                                                                                                                                                                                                                                    |
| pricingType             | string       | Enum value. One of `no_price, fixed_price`                                                                                                                                                                                                                                                                                                                            |
| status                  | string       | Enum value. One of `NEW, PENDING, COMPLETED, EXPIRED, UNRESOLVED, RESOLVED, CANCELLED, REFUNDED`                                                                                                                                                                                                                                                                      |
| context                 | string       | For charges with `UNRESOLVED` status, additional context is provided. Context can be one of the following: `UNDERPAID`, `OVERPAID`, `DELAYED`, `MULTIPLE`, `MANUAL`, `OTHER`                                                                                                                                                                                          |
| localCurrency           | string       | Local currency used for the charge. Default is `USD`                                                                                                                                                                                                                                                                                                                  |
| localPrice              | Object       | <p>Charge price by local currency. This object has 2 fields.<br><code>amount</code>: Charge amount.<br><code>currency</code>: local currency used</p>                                                                                                                                                                                                                 |
| fizenpayFeePerc         | number       | FizenPay service fee. Initialized with `0.5`, mean FizenPay will cut out 0.5% value of payments                                                                                                                                                                                                                                                                       |
| flexiblePaymentSettings | Object       | <p>Flexible payment settings at the time that the charge is created. This object has 3 fields.<br><code>type</code>: Enum value. One of <code>ABSOLUTE, RELATIVE.</code><br><code>underPaymentThresholdValue</code>: value that merchant accept for underpaid payment.<br><code>overPaymentThresholdValue</code>: value that merchant accept of overpaid payment.</p> |
| metadata                | any          | Self defined metadata provided creator.                                                                                                                                                                                                                                                                                                                               |
| logoUrl                 | string       | Merchant logo URL. This logo will be displayed on the payment screen.                                                                                                                                                                                                                                                                                                 |
| redirectUrl             | string       | Redirect URL                                                                                                                                                                                                                                                                                                                                                          |
| cancelUrl               | string       | Cancel URL                                                                                                                                                                                                                                                                                                                                                            |
| hostedUrl               | string       | Hosted URL which is generated by FizenPay                                                                                                                                                                                                                                                                                                                             |
| timeline                | Object Array | <p>Charge status changes. This object has 3 fields.<br><code>status</code>: changed status.<br><code>context</code>: Context that status is changed to <code>UNRESOLVED</code>.<br><code>time</code>: the time that status changed</p>                                                                                                                                |
| code                    | string       | Unique charge code. Generated by FizenPay                                                                                                                                                                                                                                                                                                                             |
| resolvedRemark          | string       | Any remark when merchant resolves an unresolved charge.                                                                                                                                                                                                                                                                                                               |
| expiredAt               | Date         | Expired time if there is no payment is made for this charge                                                                                                                                                                                                                                                                                                           |
| createdAt               | Date         | Time that charge is created                                                                                                                                                                                                                                                                                                                                           |
| updatedAt               | Date         | Time that charge is last updated                                                                                                                                                                                                                                                                                                                                      |
| amountRequested         | string       | Local currency or Crypto currency requested to pay                                                                                                                                                                                                                                                                                                                    |
| currencyType            | string       | `LOCAL_CURRENCY` or `CRYPTO_CURRENCY`. The type of currency is requested to pay                                                                                                                                                                                                                                                                                       |
| cryptoSlug              | string       | Crypto slug of crypto currency requested if currencyType= `CRYPTO_CURRENCY`                                                                                                                                                                                                                                                                                           |
|                         |              |                                                                                                                                                                                                                                                                                                                                                                       |

You can explore more details of  charge actions by go through next API document details

#### Object `amountReceived`

| FIELD           | TYPE   | DESCRIPTION                                 |
| --------------- | ------ | ------------------------------------------- |
| crypto          | string | Cryptocurrency symbol                       |
| cryptoAmount    | string | Paid amount by crypto                       |
| localAmount     | string | Paid amount converted to local currency     |
| localCurrency   | string | Local currency symbol                       |
| transactionHash | string | Blockchain transaction hash for the payment |

#### Object `timeline`

| FIELD   | TYPE   | DESCRIPTION                                                                                           |
| ------- | ------ | ----------------------------------------------------------------------------------------------------- |
| status  | string | Status of charge. One of: NEW, PENDING, COMPLETED, EXPIRED, UNRESOLVED, RESOLVED, CANCELLED, REFUNDED |
| context | string | Context detail if the charge is UNRESOLVED. One of: OVERPAID, UNDERPAID, MULTIPLE, DELAYED, OTHER     |

### JSON sample

```
{
  "data": {
    "addresses": {
      "bnb-bsc": {
        "address": "0x0000000000000000000000000000000000000000",
        "cmcId": 1839,
        "contract": "0x237B15c5ddA7809fC1Cb0d1a8bD31F5eA232Cc24",
        "network": "binance-smart-chain-testnet"
      },
      "busd-bsc": {
        "address": "0x718f381412b0ec0B9a6f69a77E3c7128C75E77B5",
        "cmcId": 4687,
        "contract": "0x237B15c5ddA7809fC1Cb0d1a8bD31F5eA232Cc24",
        "network": "binance-smart-chain-testnet"
      },
      "doge-bsc": {
        "address": "0x6aed42281c7bE19fa5f7a6ee5d873B85A5306bFe",
        "cmcId": 74,
        "contract": "0x237B15c5ddA7809fC1Cb0d1a8bD31F5eA232Cc24",
        "network": "binance-smart-chain-testnet"
      },
      "eth-bsc": {
        "address": "0x17fA95F49e69F82766C7930D4035b2973fbe95b8",
        "cmcId": 2396,
        "contract": "0x237B15c5ddA7809fC1Cb0d1a8bD31F5eA232Cc24",
        "network": "binance-smart-chain-testnet"
      },
      "luna-bsc": {
        "address": "0xc4E4FE5FcB38fE9D3BC327e384A57105955C9F9d",
        "cmcId": 4172,
        "contract": "0x237B15c5ddA7809fC1Cb0d1a8bD31F5eA232Cc24",
        "network": "binance-smart-chain-testnet"
      },
      "shib-bsc": {
        "address": "0x00A7D83B69C8c9223438F0Aca93453c89e0E66Ac",
        "cmcId": 5994,
        "contract": "0x237B15c5ddA7809fC1Cb0d1a8bD31F5eA232Cc24",
        "network": "binance-smart-chain-testnet"
      },
      "usdc-bsc": {
        "address": "0x3a943EFa37979952DE37168aE7D9B2E8723D9316",
        "cmcId": 3408,
        "contract": "0x237B15c5ddA7809fC1Cb0d1a8bD31F5eA232Cc24",
        "network": "binance-smart-chain-testnet"
      },
      "usdt-bsc": {
        "address": "0x53653887c75d611A8EfbdA2c1FB97CFD17Bfff71",
        "cmcId": 825,
        "contract": "0x237B15c5ddA7809fC1Cb0d1a8bD31F5eA232Cc24",
        "network": "binance-smart-chain-testnet"
      }
    },
    "amountReceived": [
      {
        "crypto": "BNB",
        "cryptoAmount": "0.000614952066849013",
        "localAmount": "0.2",
        "localCurrency": "USD",
        "transactionHash": "0x08c60c38a600e63905b19a2775b1d662a846c06f726bfeb5c0f419a2c58422bc"
      },
      {
        "crypto": "BNB",
        "cryptoAmount": "0.000614952066849113",
        "localAmount": "0.2",
        "localCurrency": "USD",
        "transactionHash": "0x1ef2640f920c46ee02b82d079e9a83a1cc602063325609c7b66f9c0a920faaea"
      }
    ],
    "code": "ML1A7PJ3F3PY",
    "context": "MULTIPLE",
    "createdAt": "2022-05-23T06:58:49.557Z",
    "currencyType": "LOCAL_CURRENCY",
    "customerEmail": "test@gmail.com",
    "customerName": "",
    "exchangeRateByUSD": "1",
    "exchangeRates": {
      "bnb-bsc-usd": "325.2286003765969",
      "busd-bsc-usd": "1.0005404341502755",
      "doge-bsc-usd": "0.08652585187256893",
      "eth-bsc-usd": "2050.8523351464096",
      "luna-bsc-usd": "0.00019356603824367347",
      "shib-bsc-usd": "0.000012191971099821102",
      "usdc-bsc-usd": "1.0003980008414488",
      "usdt-bsc-usd": "0.9991066318536912"
    },
    "expiredAt": "2022-05-24T06:58:49.544Z",
    "fizenpayFeePerc": "33",
    "flexiblePaymentSettings": {
      "overPaymentCurrency": "USD",
      "overPaymentThresholdValue": "2000",
      "type": "RELATIVE",
      "underPaymentCurrency": "USD",
      "underPaymentThresholdValue": "50"
    },
    "hostedUrl": "https://payment.fizen.io/commerce/charges/ML1A7PJ3F3PY",
    "id": "628b30a923ed950008b950a9",
    "localCurrency": "USD",
    "localExchangeRates": {
      "bnb-bsc-usd": "325.2286003765969",
      "busd-bsc-usd": "1.0005404341502755",
      "doge-bsc-usd": "0.08652585187256893",
      "eth-bsc-usd": "2050.8523351464096",
      "luna-bsc-usd": "0.00019356603824367347",
      "shib-bsc-usd": "0.000012191971099821102",
      "usdc-bsc-usd": "1.0003980008414488",
      "usdt-bsc-usd": "0.9991066318536912"
    },
    "localPrice": {
      "amount": "0.2",
      "currency": "USD"
    },
    "merchant": {
      "email": "test@gmail.com",
      "name": null
    },
    "merchantId": "628603dd75ebdf00083568dc",
    "name": "INVOICE - ML1A7PJ3F3PY",
    "payment": {
      
    },
    "pricing": {
      "bnb-bsc": {
        "amount": "0.000614952066849013",
        "cmcId": 1839,
        "currency": "BNB",
        "decimal": 18,
        "network": "binance-smart-chain-testnet",
        "networkId": "97",
        "transferAmount": "614952066849013"
      },
      "busd-bsc": {
        "amount": "0.199891971552207288",
        "cmcId": 4687,
        "currency": "BUSD",
        "decimal": 18,
        "network": "binance-smart-chain-testnet",
        "networkId": "97",
        "transferAmount": "199891971552207288"
      },
      "doge-bsc": {
        "amount": "2.311447916104313901",
        "cmcId": 74,
        "currency": "DOGE",
        "decimal": 18,
        "network": "binance-smart-chain-testnet",
        "networkId": "97",
        "transferAmount": "2311447916104313901"
      },
      "eth-bsc": {
        "amount": "0.000097520429224721",
        "cmcId": 2396,
        "currency": "WETH",
        "decimal": 18,
        "network": "binance-smart-chain-testnet",
        "networkId": "97",
        "transferAmount": "97520429224721"
      },
      "luna-bsc": {
        "amount": "1033.239104414727143858",
        "cmcId": 4172,
        "currency": "LUNA",
        "decimal": 18,
        "network": "binance-smart-chain-testnet",
        "networkId": "97",
        "transferAmount": "1033239104414727143858"
      },
      "shib-bsc": {
        "amount": "16404.238360024876160848",
        "cmcId": 5994,
        "currency": "SHIB",
        "decimal": 18,
        "network": "binance-smart-chain-testnet",
        "networkId": "97",
        "transferAmount": "16404238360024876160848"
      },
      "usdc-bsc": {
        "amount": "0.199920431500040177",
        "cmcId": 3408,
        "currency": "USDC",
        "decimal": 18,
        "network": "binance-smart-chain-testnet",
        "networkId": "97",
        "transferAmount": "199920431500040177"
      },
      "usdt-bsc": {
        "amount": "0.200178833393318847",
        "cmcId": 825,
        "currency": "USDT",
        "decimal": 18,
        "network": "binance-smart-chain-testnet",
        "networkId": "97",
        "transferAmount": "200178833393318847"
      }
    },
    "pricingType": "fixed_price",
    "showLogo": true,
    "status": "UNRESOLVED",
    "supportEmail": "test@gmail.com",
    "timeline": [
      {
        "context": null,
        "status": "NEW",
        "time": "2022-05-23T06:58:49.557Z",
        "transactionDetail": null
      },
      {
        "context": null,
        "status": "PENDING",
        "time": "2022-05-23T07:01:41.758Z",
        "transactionDetail": null
      },
      {
        "context": null,
        "status": "COMPLETED",
        "time": "2022-05-23T07:01:51.660Z",
        "transactionDetail": "https://testnet.bscscan.com/tx/0x08c60c38a600e63905b19a2775b1d662a846c06f726bfeb5c0f419a2c58422bc"
      },
      {
        "context": null,
        "status": "PENDING",
        "time": "2022-05-23T07:02:18.664Z",
        "transactionDetail": null
      },
      {
        "context": "MULTIPLE",
        "status": "UNRESOLVED",
        "time": "2022-05-23T07:02:24.639Z",
        "transactionDetail": "https://testnet.bscscan.com/tx/0x1ef2640f920c46ee02b82d079e9a83a1cc602063325609c7b66f9c0a920faaea"
      }
    ],
    "transactionType": "INVOICE",
    "updatedAt": "2022-05-26T09:04:10.037Z"
  },
  "statusCode": 200,
  "time": "2022-08-02T16:31:36.674Z",
  "total": 0
}
```
