Submit an invoice for payment
Response data
Term | Type | Description |
---|---|---|
ID | string | Unique invoice identifier |
T | int | Timestamp when invoice is created |
TYPE | string | Invoice type, currently supported ECOMMERCE and POS |
DURATION | int | Invoice expire time in seconds |
AMOUNT | float | Invoice amount in currency |
CURRENCY | string | Invoice currency |
ORDER_ID | string | Reference order identifier in merchant's platform |
PAY_CURRENCIES | array of strings | Currencies in which invoice accepts the payments |
WEBHOOK | string | Optional, the endpoint that will be called once the payment is completed/expired |
REDIRECT_URL | string | Optional, merchant redirect URL, this one is used in UI to redirect customer to merchant's site once the payment is completed/expired |
STATUS | string | Payment status, should be one of: CREATED, PENDING, COMPLETED, EXPIRED |
CUSTOMER_INFO | object | Information related to customer against who the invoice is issued, it's NULL when type is POS |
CUSTOMER_TYPE | string | Customer type, either INDIVIDUAL or BUSINESS |
CUSTOMER_NATIONALITY | string | Customer's nationality, alpha2 code format |
CUSTOMER_RESID_COUNTRY | string | Customer's residential country, alpha2 code format |
CUSTOMER_RESID_STATE | string | Optional, customer's residential state/province |
CUSTOMER_RESID_CITY | string | Customer's residential city/town |
CUSTOMER_RESID_ZIP | string | Customer's residential zip code/postal code |
CUSTOMER_RESID_STREET | string | Customer's residential street address |
CUSTOMER_RESID_NO | string | Optional, customer's residential building number/name |
CUSTOMER_FULLNAME | string | Customer's full name |
CUSTOMER_EMAIL | string | Customer's email address |
CUSTOMER_TOS_ACCEPTED | boolean | Flag that specified whenever the customer has accepted terms of service |
CUSTOMER_IP | string | Optional, customer's ip address |
INVOICES | array of objects | Payment details for each payable currency |
INVOICES_AMOUNT | float | Amount in specific payable currency |
INVOICES_BFXPAY_CCY | string | Bitfinex pay currency that corresponds to list of PAY_CURRENCIES |
INVOICES_PAY_CCY | string | Payment currency |
INVOICES_POOL_CCY | string | Underlying technology used by payment currency |
INVOICES_ADDRESS | string | Deposit/Payment address |
INVOICES_EXT | object | Optional, additional data related to payment |
METADATA | object | Optional, invoice metadata |
FLAGS | array of strings | Optional, flags related to invoice |
RECALCULATED_AT | int | Optional, timestamp in milliseconds when invoice prices got recalculated |
key permissions
The api key permissions should include these settings in order to be able to create the invoice:
- Account Info - both get account fee and edit account info should be enabled
- Orders - both get orders and create/cancel orders should be enabled
The api key permissions can be checked through key permissions endpoint, where it should have read and write flags set to 1 for these options:
- settings
- account
- orders
payment addresses
All the payments are done against user's merchant sub account, before being able to accept the deposits the user should generate deposit addresses for currencies that expects to be paid with. This can be done either through UI by going on deposit page, or through api by calling deposit address endpoint
webhook
Webhook must be an endpoint that would accept POST requests with JSON body. In request body the following invoice fields will be send:
- id: string
- type: string // invoice type
- orderId: string
- status: string // COMPLETED or EXPIRED
- amount: float
- currency: string
- t: int // timestamp
- invoices: array of object // if expired no item will be included, if paid only the paid invoice
- payment: object // present only in case of success
- txid: string // transaction hash
- amount: float // amount in payable ccy
- currency: string
- method: string // method of deposit. For an up-to-date mapping of methods and their respective currencies see: https://api-pub.bitfinex.com//v2/conf/pub:map:tx:method [[[METHOD,[CURRENCY]]...]]
- status: 'COMPLETED'
- confirmations: int
- created_at: 'YYYY-MM-DD hh:mm:ss'
- updated_at: 'YYYY-MM-DD hh:mm:ss'
- depositId: int // optional, deposit id linked to payment, present when payment is done through wallet deposit
- ledgerId: int // optional, ledger id linked to payment, present when payment is realized through "Instant Payment",
- forceCompleted: boolean // optional, flag indicating that invoice is manually marked as completed
- amountDiff: string // optional, paid amount difference from deposited amount and expected amount in invoice
- additionalPayments: array // optional, additional payments, applied when invoice has partial underpaid payments, it's basically array of objects with same structure as payment field
Example request:
POST https://example.com/api/v3/order/order123 { "id": "a6761c8b-468f-40ad-a522-cc5e41c39757", "type": "ECOMMERCE", "orderId": "order123", "status": "COMPLETED", "amount": 2.5, "currency": "USD", "t": 1612460165497, "invoices": [ { "amount": 0.00006262, "currency": "BTC", "payCurrency": "BTC", "poolCurrency": "BTC", "address": "bc1qyegkyyk656vrqp0pzyg8p4yy9xlqfhxlrg0jtf" } ], "payment": { "txid": "5119b4caaad1af22bebb2373995d8ecd8dfb23cc1971d0347aaa516b4e0f3e3a", "amount": 0.00006262, "currency": "BTC", "method": "BITCOIN", "status": "COMPLETED", "confirmations": 6, "created_at": "2021-01-06 21:16:28", "updated_at": "2021-01-06 21:16:28", "depositId": 1357996 } }
webhook
Warning! Webhook will be called only once and in case of failure it's not triggered again, due to that case merchants can also use /v2/auth/r/ext/pay/invoices endpoint to query the invoice states.
invoices: { ext: ... }
Ext field contains additional data related to payment. In case of lighting network (LNX) payment it should look like this: { "hash": string, "payment_request": string, "node_pub": string }.
invoices: { poolCurrency: ... }
Pool currency represents the underlying blockchain used by payable currency, e.g. in case of UST-ETH which is an ERC-20 token poolCurrency is ETH.
flags
Invoice might have flags that are automatically added depending on data. Currently supported flags are:
- ip:prohibited - added when customer's ip belongs to a prohibited jurisdiction
Ratelimit: 90 req/min