{"info":{"name":"Cryptain API","description":"Set public_key and secret_key in the collection variables. Requests are signed automatically. Guide: https://cryptain.net/docs","schema":"https://schema.getpostman.com/json/collection/v2.1.0/collection.json"},"event":[{"listen":"prerequest","script":{"type":"text/javascript","exec":["// Signs every request: HMAC-SHA256(timestamp \\n METHOD \\n path?query \\n raw body)","const ts = Math.floor(Date.now() / 1000).toString();","const resolved = pm.variables.replaceIn(pm.request.url.toString());","const u = resolved.replace(/^[a-z]+:\\/\\/[^/]+/i, '');","const body = pm.request.body && pm.request.body.mode === 'raw' ? pm.variables.replaceIn(pm.request.body.raw) : '';","const sig = CryptoJS.HmacSHA256([ts, pm.request.method, u, body].join('\\n'), pm.environment.get('secret_key') || pm.collectionVariables.get('secret_key')).toString(CryptoJS.enc.Hex);","pm.request.headers.upsert({ key: 'X-Api-Key', value: pm.environment.get('public_key') || pm.collectionVariables.get('public_key') });","pm.request.headers.upsert({ key: 'X-Timestamp', value: ts });","pm.request.headers.upsert({ key: 'X-Signature-Version', value: '2' });","pm.request.headers.upsert({ key: 'X-Signature', value: sig });"]}}],"variable":[{"key":"base_url","value":"https://cryptain.net/api/v1"},{"key":"public_key","value":"pk_..."},{"key":"secret_key","value":"sk_..."}],"item":[{"name":"General","item":[{"name":"Check your API keys","request":{"method":"GET","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/ping","host":["{{base_url}}"],"path":["ping"],"query":[],"variable":[]}}}]},{"name":"Invoices","item":[{"name":"Create an invoice","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/invoices","host":["{{base_url}}"],"path":["invoices"],"query":[],"variable":[]},"body":{"mode":"raw","raw":"{\n    \"amount\": \"49.00\",\n    \"currency\": \"USD\",\n    \"order_id\": \"1024\",\n    \"description\": \"Order #1024\"\n}","options":{"raw":{"language":"json"}}}}},{"name":"List invoices","request":{"method":"GET","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/invoices","host":["{{base_url}}"],"path":["invoices"],"query":[{"key":"status","value":"","description":"Filter by status","disabled":true},{"key":"order_id","value":"","description":"Filter by your order reference","disabled":true},{"key":"page","value":"","description":"Page number, from 1","disabled":true},{"key":"limit","value":"","description":"1 to 100, default 25","disabled":true}],"variable":[]}}},{"name":"Get an invoice","request":{"method":"GET","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/invoices/:id","host":["{{base_url}}"],"path":["invoices",":id"],"query":[],"variable":[{"key":"id","value":""}]}}},{"name":"Cancel an unpaid invoice","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/invoices/:id/cancel","host":["{{base_url}}"],"path":["invoices",":id","cancel"],"query":[],"variable":[{"key":"id","value":""}]}}}]},{"name":"Payment links","item":[{"name":"Create a payment link","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/payment-links","host":["{{base_url}}"],"path":["payment-links"],"query":[],"variable":[]},"body":{"mode":"raw","raw":"{\n    \"title\": \"Donation\",\n    \"type\": \"donation\",\n    \"currency\": \"USD\"\n}","options":{"raw":{"language":"json"}}}}},{"name":"List payment links","request":{"method":"GET","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/payment-links","host":["{{base_url}}"],"path":["payment-links"],"query":[],"variable":[]}}},{"name":"Get a payment link","request":{"method":"GET","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/payment-links/:slug","host":["{{base_url}}"],"path":["payment-links",":slug"],"query":[],"variable":[{"key":"slug","value":""}]}}},{"name":"Update a payment link","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/payment-links/:slug","host":["{{base_url}}"],"path":["payment-links",":slug"],"query":[],"variable":[{"key":"slug","value":""}]},"body":{"mode":"raw","raw":"{\n    \"active\": false\n}","options":{"raw":{"language":"json"}}}}},{"name":"Invoices started from a link","request":{"method":"GET","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/payment-links/:slug/invoices","host":["{{base_url}}"],"path":["payment-links",":slug","invoices"],"query":[{"key":"status","value":"","description":"Filter by status","disabled":true}],"variable":[{"key":"slug","value":""}]}}}]},{"name":"Recurring invoices","item":[{"name":"Create a recurring invoice","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/subscriptions","host":["{{base_url}}"],"path":["subscriptions"],"query":[],"variable":[]},"body":{"mode":"raw","raw":"{\n    \"customer_email\": \"customer@example.com\",\n    \"description\": \"Pro plan\",\n    \"amount\": \"29.00\",\n    \"currency\": \"USD\",\n    \"period\": \"monthly\",\n    \"pay_days\": 7\n}","options":{"raw":{"language":"json"}}}}},{"name":"List recurring invoices","request":{"method":"GET","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/subscriptions","host":["{{base_url}}"],"path":["subscriptions"],"query":[{"key":"status","value":"","description":"active, paused, cancelled or completed","disabled":true},{"key":"customer_email","value":"","description":"Filter by customer","disabled":true}],"variable":[]}}},{"name":"Get a recurring invoice","request":{"method":"GET","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/subscriptions/:id","host":["{{base_url}}"],"path":["subscriptions",":id"],"query":[],"variable":[{"key":"id","value":""}]}}},{"name":"Pause, resume, cancel or bill now","request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/subscriptions/:id/:action","host":["{{base_url}}"],"path":["subscriptions",":id",":action"],"query":[],"variable":[{"key":"id","value":""},{"key":"action","value":"pause"}]}}}]},{"name":"Reference","item":[{"name":"Coins your store accepts","request":{"method":"GET","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/currencies","host":["{{base_url}}"],"path":["currencies"],"query":[],"variable":[]}}},{"name":"Current price of one coin","request":{"method":"GET","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/rates","host":["{{base_url}}"],"path":["rates"],"query":[{"key":"currency","value":"","description":"Fiat currency, e.g. USD","disabled":true}],"variable":[]}}}]},{"name":"Reporting","item":[{"name":"Balances per coin","request":{"method":"GET","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/balance","host":["{{base_url}}"],"path":["balance"],"query":[],"variable":[]}}},{"name":"Withdrawals, refunds and payouts","request":{"method":"GET","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/withdrawals","host":["{{base_url}}"],"path":["withdrawals"],"query":[],"variable":[]}}},{"name":"Volume and fees for a date range","request":{"method":"GET","header":[{"key":"Content-Type","value":"application/json"}],"url":{"raw":"{{base_url}}/stats","host":["{{base_url}}"],"path":["stats"],"query":[{"key":"from","value":"","description":"YYYY-MM-DD, default first day of this month","disabled":true},{"key":"to","value":"","description":"YYYY-MM-DD, default today","disabled":true}],"variable":[]}}}]}]}