> For the complete documentation index, see [llms.txt](https://manual-en.boxexchanger.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual-en.boxexchanger.net/for-developers-done/processing-platezhei-api.md).

# API payment processing / DONE

Accept payments through your exchanger for other sites. Act as a payment processor

![](https://510499886-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYc4e1MOylcSxJb4nS0Eo%2Fuploads%2Fgit-blob-e0de551af5a0953f3836f864849c116e6aa38c93%2Fimage%20\(328\).png?alt=media)

### Create a request

Use the publi&#x63;**/exchanger/order/create method**

| Name                    | Description                                                                                                                                                                        | Type     |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| routeId                 | destination id                                                                                                                                                                     | ObjectID |
| partner                 | partner code                                                                                                                                                                       | STRING   |
| amount                  | sum                                                                                                                                                                                | FLOAT    |
| fromValues\[0]\[key]    | field key                                                                                                                                                                          | ObjectID |
| fromValues\[0]\[value]  | field value                                                                                                                                                                        | STRING   |
| toValues\[0]\[key]      | field key                                                                                                                                                                          | STRING   |
| toValues\[0]\[value]    | field value                                                                                                                                                                        | STRING   |
| routeValues\[0]\[key]   | field key                                                                                                                                                                          | ObjectID |
| routeValues\[0]\[value] | field value                                                                                                                                                                        | STRING   |
| lang                    | language (eng, rus)                                                                                                                                                                | STRING   |
| agreement               | agreement                                                                                                                                                                          | BOOLEAN  |
| hideOutData             | hide details                                                                                                                                                                       | BOOLEAN  |
| clientCallbackUrl       | callback, when the application is completed, the client will see a button to return to the site, and the client will be redirected to this url ?status=success or to ?status=error | STRING   |
| ipnUrl                  | URL of instant payment notification (will be called when order status changes)                                                                                                     | STRING   |
| ipnSecret               | string to create a secure hash in ipn url                                                                                                                                          | STRING   |

Documentation for the authorisation system can be found in your personal cabinet. More information about working with methods and additional data can be found at

### **IPN (**&#x50;ayment Request Status Change Notificatio&#x6E;**)**

To receive notification of a status change when a request is created, you need to provide additional parameters:

* `clientCallbackUrl` - Callback URL. When the request is completed, the client will see a button to return to the website, and the client will be redirected to this URL.
* `hideOutData` - Hide recipient data.
* `ipnUrl` - HTTP/HTTPS URL for notifying your server.
* `ipnSecret` - Random string for creating the request signature (to maintain request integrity).

1. The request will be sent via the POST method.&#x20;
2. IPN will be sent once.&#x20;
3. IPN delivery is not guaranteed (if the server does not respond to the request, it will not be resent).

**Example IPN**

* POST
* \['Content-Type'] = 'application/x-www-form-urlencoded'\\
* `orderUID` :Number() - request uid
* `orderId` :String(ObjectId) -request id
* `newStatus` :String() - current request 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 and ipn notification
* `toValues` :Array(\[{key,name,value}]) - request details

### **Status list**

* `new` - new request
* `waitPayment` - waiting for user payment
* `errorPayment` - user payment error (sender’s error)
* `inProgress` - in process (awaiting admin processing or request payment)
* `inProgressPayout` - queued for payout (payment successfully received) (if automatic payment is set in currency, it will be initiated)
* `errorPayout` - payout error (error during payout)
* `hold` - request frozen (application issues)
* `done` - request successfully paid out
* `returned` - request was paid, but not all exchange conditions and sender’s refund methods were met
* `deleted` - request deleted (canceled)

### **Request Checksum Verification (IPN)**<br>

*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 Monitoring**<br>

1. To monitor request status, log in, and all requests will be displayed in your dashboard;
2. &#x20;You can save the request UID and secret and manually go to the request by entering these details in the address bar.

### **Payment**

1. You can use /payment/ to display the payment page:\
   \
   `// schema`\
   `protocol://domain/user-lang/payment/order-uid/order-secret`\
   `// example result`\
   `https://www.domain.com/en/payment/1409/dGqwF2M2eBPaSN1G5ljMS1cb`
2. You can also display the link on the exchange as all clients see it, following the same schema as the first option, except replacing /payment/ with /order/.
3. The method has parameters that allow displaying payment data or the payment form on your site, which you can use.\
   **IMPORTANT**: if a prepayment method is used, you need to update the order status from `waitPayment` to `inProgress` after payment.
