Integration with your service

Merchant docs

Create order

Use method public/exchanger/order/create

NameDescriptionType
routeIdid routeObjectID
partnerlink partnerSTRING
amountamount inFLOAT
fromValues[0][key]key nameObjectID
fromValues[0][value]value for this fieldSTRING
toValues[0][key]key nameSTRING
toValues[0][value]value for this fieldSTRING
routeValues[0][key]key nameObjectID
routeValues[0][value]value for this fieldSTRING
langlang client (ru,en)STRING
agreementagreementBOOLEAN
hideOutDatasecure out requisitesBOOLEAN
clientCallbackUrl 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 ?status=success or ?status=error STRING
ipnUrlinstant payment notification url (will be called when the order has changed status) STRING
ipnSecretstring for create secure hash in ipn urlSTRING

You can find the documentation for the authorization system in your personal cabinet. More about working with methods and additional data can be found on the

IPN (Notification about the payment request status change)

In order to receive a notification of order status change when creating an order, you need to send additional parameters:

  • clientCallbackUrl - 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
  • hideOutData - hide the recipient's details
  • ipnUrl - HTTP/HTTPS link to notify your server.
  • ipnSecret - Random string for creating a request signature (for maintaining request integrity)
  1. The request will be sent by POST method
  2. IPN will be sent once
  3. IPN delivery is not guaranteed (if the server did not respond to the request it will not be resent)

Example IPN

  • POST
  • ['Content-Type'] = 'application/x-www-form-urlencoded'
  • orderUID :Number() - order uid
  • orderId :String(ObjectId) -order id
  • newStatus :String() - order current status
  • inAmount :String(number) - order in sum
  • outAmount :String(number) - order out sum
  • xml_from :String() - order uid
  • xml_to :String() - order uid
  • timestamp :Number() - unix time ipn notify
  • toValues :Array([{key,name,value}]) - order requisites

Statuses list

  • 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 af3acf947e6f0e0f2c267e300b8582e504dba12d1f2d058652b7414163c09f48
            

Payment control

  1. If you need to control the status of requests, create them using authorization, then all requests will be reflected in your personal cabinet;
  2. 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

  1. You can use / payment / to show payment page
    // schemahttps://bcx.exchange/user-lang/payment/order-uid/order-secret// example resulthttps://bcx.exchange/en/payment/1409/dGqwF2M2eBPaSN1G5ljMS1cb
  2. 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/
  3. 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.

Feeling lost? Contact us!