How do I use an API? 1. Please add the IPv4 or IPv6 addresses that will be allowed to access the API 2. Your Account Data $account['username_id'] = 1153; $account['encryption_iv'] = 'c820564bcc23e125'; $account['encryption_password'] = 'e6ecdc4a28138d7946d0b70e140537abb681a5e6a46202faf383ad554ecd4c92eab626f8bcfe9020abd30c51b731fe07adf5182b600fa0bd6adb5e5b8afb1f14'; 3. Functions to be used Do not change. Copy and paste // Function [Generating signature] function sign(array $dataSet, $pw, $algo) { if (isset($dataSet['sign'])) { unset($dataSet['sign']); } ksort($dataSet, SORT_STRING); array_push($dataSet, $pw); $signString = implode(':', $dataSet); $signString = hash($algo, $signString, true); return base64_encode($signString); } // Function [Encrypting data] function encrypt($secret_pw, $secret_iv, $string) { $encrypt_method = "AES-256-CBC"; $pw = hash('sha256', $secret_pw); $iv = substr(hash('sha256', $secret_iv), 0, 16); $output = openssl_encrypt($string, $encrypt_method, $pw, 0, $iv); $output = base64_encode($output); return $output; } 4. Generating API signature PHP Examples $payment['amount'] = 1000; //required; allowed up to two decimal places $payment['currency'] = "RUB"; //required $payment['description'] = "Test Payment"; //required $payment['order_number'] = "6c8e9483e15f"; //required; unique variable $payment['type_payment'] = "merchant"; //required; variable = merchant $payment['usr'] = "new"; //required; variable = old or new $payment['custom_field'] = ""; //required; this variable can be empty $payment['callback_url'] = base64_encode("https://example.com/callback.php"); //required; URL address for callback // Optional $payment['customer_email'] = "demo@example.com"; //If you provide an email, it will not be requested on the payment page $payment['success_url'] = base64_encode("https://example.com/success.php"); //URL for button on successful payment page $payment['error_url'] = base64_encode("https://example.com/error.php"); //URL for button on error payment page // Generating API signature using Encryption Password $payment['signature'] = sign($payment, $account['encryption_password'], 'md5'); 5. Encoding an array into a JSON string PHP Examples $payment = json_encode($payment, JSON_UNESCAPED_UNICODE); 6. Encrypting the previously received JSON string PHP Examples // Encrypting the previously received JSON string using Encryption Password and Encryption IV $payment = encrypt($account['encryption_password'], $account['encryption_iv'], $payment); 7. Submitting a POST Request to the API and redirecting the user to the payment page In [data->url] you will receive a link to the payment page (old version), and in [data->payment_methods], you will receive links to payment pages for available payment methods For your account, the following payment methods are enabled: card PHP Examples // Successful request return HTTP status code 200 $API_URL = "https://api.b2pay.io/merchantpayments.php"; Before accepting live payments, you can use our test cards Use the value $API_URL = "https://sandbox.b2pay.io/merchantpayments.php"; $data['payment'] = $payment; $data['id'] = $account['username_id']; //$account['username_id'] = it is your Username ID $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $API_URL); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_NOBODY, false); curl_setopt($curl, CURLOPT_TIMEOUT, 60); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60); $response = curl_exec($curl); $response = json_decode($response, true); if (curl_errno($curl)) { exit(curl_error($curl)); } else { $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); if ($httpCode == "200") { if ($response['data']['status'] == "success") { print_r($response['data']); exit; } else { exit($response['data']['message']); } } else { if (isset($response['data'])) { exit($response['data']['message']); } else exit($httpCode); } } curl_close($curl); 8. Waiting a results to callback URL from our IP addresses 154.127.54.154, 154.127.54.155, 154.127.54.156, 45.43.19.130, 45.43.19.131, 45.43.19.132 $result = json_decode(file_get_contents('php://input'), true); $result['sign'] = ""; //signature $result['pay_id'] = ""; //payment id $result['token'] = ""; //payment token $result['type'] = "pay"; //тип платежа: pay $result['status'] = ""; //payment status $result['orderNumber'] = ""; //your order number $result['sanitizedMask'] = ""; //payers sanitized card $result['amount'] = ""; //payment amount $result['currency'] = ""; //payment currency $result['gatewayRate'] = ""; //gateway rate $result['gatewayAmount'] = ""; //gateway amount $result['gatewayCurrency'] = ""; //gateway currency // Signature Verification // Generating API signature using Encryption Password $signature = sign($result, $account['encryption_password'], 'md5'); if ($result['sign'] != $signature) { exit("Incorrect signature"); } We define a notification as “successfully being sent” only in the case that your server responded with a 200 HTTP status code and body “ok” If your server responded any error codes, we schedule recursive callbacks within a 15 minutes interval, but not more than 5 times Payment status Статус Описание pending Payment in progress approved Платеж успешно завершен declined Unsuccessful payment [If applicable, fee apply] rejected Unsuccessful payment expired Unsuccessful payment chargeback Funds returned to the cardholder refund Funds returned to the cardholder refund_request Refund request created refund_canceled Refund request canceled no_suitable No suitable payment gateways gateway_error Payment failed due to a technical error at the gateway Есть такая документация напиши ее реализацию на express nodejs