Integration with service 1cent
Create order
POST /public/exchanger/order/create
| Parameter | Type | Description |
routeId | ObjectID | id route |
partner | String | link partner |
amount | Float | amount in |
fromValues | Array | [{key: ObjectID, value: String}] |
toValues | Array | [{key: String, value: String}] |
routeValues | Array | [{key: ObjectID, value: String}] |
lang | String | lang client (ru,en) |
agreement | Boolean | agreement |
hideOutData | Boolean | secure out requisites |
clientCallbackUrl | String | a callback when the application is completed the client will see a button for return back to the site and the client will be directed to this URL |
ipnUrl | String | instant payment notification url |
ipnSecret | String | string for create secure hash in ipn url |
skipPreview | Boolean | skip the order confirmation step |
POST https://www.1cent.io/public/exchanger/order/create
Content-Type: application/json
{
"routeId": "64a1f3...",
"amount": 100,
"lang": "ru",
"agreement": true,
"clientCallbackUrl": "https://your-merchant-site.com/callback",
"ipnUrl": "https://your-merchant-site.com/ipn",
"ipnSecret": "your_secret"
}{
status: "success",
error: 0,
data: {
orderUID: 1409,
orderId: "64a1f3...",
orderSecret: "dGqwF2M2...",
paymentUrl: "https://www.1cent.io/en/payment/1409/dGqwF2M2..."
}
}Get order
GET /public/exchanger/order/get
| Parameter | Type | Description |
orderUID | Number | numeric order ID |
orderSecret | String | order secret from /order/create response |
type | String | page type: payment or order |
GET https://www.1cent.io/public/exchanger/order/get
?orderUID=1409
&orderSecret="dGqwF2M2..."
&type="payment"{
"orderUID": 1409,
"orderId": "64a1f3...",
"newStatus": "waitPayment",
"inAmount": "100",
"outAmount": "317.42",
"xml_from": "ETH",
"xml_to": "WMZ"
}Update order status
Used to confirm payment for manual payment method — transitions the order from waitPayment to inProgress.
PUT /public/exchanger/order/update-status
| Parameter | Type | Description |
orderUID | Number | numeric order ID |
orderSecret | String | order secret from /order/create response |
status | String | new order status (e.g. inProgress) |
PUT https://www.1cent.io/public/exchanger/order/update-status
Content-Type: application/json
{
"orderUID": 1409,
"orderSecret": "dGqwF2M2...",
"status": "inProgress"
}{
"status": "success",
"order": {
"orderUID": 1409,
"newStatus": "inProgress"
}
}IPN (Notification about the payment request status change)
To receive order status notifications, pass ipnUrl, ipnSecret, clientCallbackUrl and hideOutData when creating an order. When the status changes, the server sends a POST request to your ipnUrl with the following data:
POST https://your-merchant-site.com/ipn
| Parameter | Type | Description |
orderUID | Number | order uid |
orderId | String | order id (ObjectId) |
newStatus | String | order current status |
inAmount | String | incoming payment amount |
outAmount | String | outgoing payment amount |
xml_from | String | send currency |
xml_to | String | receive currency |
timestamp | Number | unix time ipn notify |
toValues | Array | [{key, name, value}] — order requisites |
POST https://www.1cent.io/public/exchanger/order/create
Content-Type: application/json
{
"routeId": "64a1f3...",
"amount": 100,
"agreement": true,
"ipnUrl": "https://your-merchant-site.com/ipn",
"ipnSecret": "your_secret",
"clientCallbackUrl": "https://your-merchant-site.com/callback",
"hideOutData": false
}POST https://your-merchant-site.com/ipn
Content-Type: application/x-www-form-urlencoded
orderUID=1409
&orderId="5d8e6002b80b7b4cd75a6424"
&newStatus="done"
&inAmount="2"
&outAmount="317.42"
&xml_from="ETH"
&xml_to="WMZ"
&timestamp=1571328406072
&toValues=[{"key":"wallet","name":"Кошелёк","value":"Z123456789"}]- IPN will be sent once
- IPN delivery is not guaranteed (if the server did not respond to the request it will not be resent)
Statuses list
| Status | Description |
new | new order |
waitPayment | wait user payment |
errorPayment | error user payment (merchant send error) |
inProgress | in progress (expects admin or payment of the application) |
inProgressPayout | in line for payment (payment accepted successfully) (if configured in currency auto payment it will be initialized) |
errorPayout | payment error (error occurred during payment) |
hold | frozen (problems with the application) |
done | order completed successfully |
returned | the order was paid but not all exchange conditions were fulfilled and the means of return to the sender |
deleted | order deleted (canceled) |
Verification of the request checksum (IPN)
sha256(orderId:newStatus:inAmount:outAmount:xml_from:xml_to:timestamp:ipnSecret)const stringForHash = orderId+":"+newStatus+":"+inAmount+":"+outAmount+":"+xml_from+":"+xml_to+":"+timestamp+":"+ipnSecret;
// example string for hash 5d8e6002b80b7b4cd75a6424:inProgress:2:317.42:ETH:WMZ:1571328406072:SECRET123
const hash = crypto.createHash('sha256').update(stringForHash).digest('hex')
// example hash af3acf947e6f0e0f2c267e300b8582e504dba12d1f2d058652b7414163c09f48Payment control
- If you need to control the status of requests, create them using authorization, then all requests will be reflected in your personal cabinet;
- You can save the UID of the request and secret and manually go to the request by specifying this data in the address bar
Payment
You can use / payment / to show payment page
GET /{lang}/payment/{orderUID}/{orderSecret}
https://www.1cent.io/en/payment/1409/dGqwF2M2eBPaSN1G5ljMS1cbHTTP/1.1 200 OK
Content-Type: text/html
<!-- Payment page for order #1409 -->- Also you can simply give a link to the exchange as it is seen by all clients according to the same scheme as it is specified in the first variant except /payment/ should be replaced with /order/
- There are parameters in the method that allow you to display the payment data or the form of payment on your site you can use them. IMPORTANT: if the method with manual payment you need to update the status of the order from waitPayment to inProgress after payment.