API
Create Payment
This API method allows you to initialize a new payment to make a payment through the Pay2.House payment service.
| Parameter | Type | Description |
|---|---|---|
| external_number | string | Unique transaction or order number. |
| amount | number | Payment or transaction amount. |
| currency_code | string | Payment currency code (for example, USD for dollar, EUR for euro, USDT for Tether). |
| merchant_id | string | Identifier of your added merchant (Merchant ID). |
| description | string | Payment or transaction description. |
| deadline_seconds | number | Sets the payment time interval in seconds (for example, 600 corresponds to a payment period of 10 minutes). The maximum value is 86400 seconds (1 day). |
| return_url | string | URL address to which the client should be returned after successful payment completion. |
| cancel_url | string | URL address to which the client should be returned if the payment is canceled. |
| handling_fee | number | Additional payment fee. |
| payer_email | string | Client email associated with the payment transaction. |
| payment_method | string | Payment method used for this transaction. Available methods: “PAY2_HOUSE”, “USDT_TRC20”, “CARDS”. The default is “ALL”, which means the client can choose the payment method independently. |
<?php
function create_payment($request_body = [])
{
$curl = curl_init('https://pay2.house/api/create_payment');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'external_number' => '10001',
'amount' => 1000,
'currency_code' => 'USD',
'payment_method' => 'ALL',
'merchant_id' => 'SN6829106944',
'description' => 'Payment for Merchant.Name',
'deadline_seconds' => 600,
'handling_fee' => 10,
'payer_email' => '[email protected]',
'return_url' => 'https://mysite.com/result',
'cancel_url' => 'https://mysite.com/cancel',
]);
$api_response = create_payment(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['approval_url'])) {
header('Location: ' . $api_response['approval_url'], TRUE, 302);
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| invoice_number | string | Unique invoice number that identifies the payment transaction in the system. |
| approval_url | string | URL link to which the client must be redirected to complete the payment. |
Payment Information
This API method allows you to request information about your payment in the Pay2.House payment system.
| Parameter | Type | Description |
|---|---|---|
| merchant_id | string | Identifier of your added merchant (Merchant ID). |
| invoice_number | string | Your invoice number. |
<?php
function show_payment_details($request_body = [])
{
$curl = curl_init('https://pay2.house/api/show_payment_details');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'merchant_id' => 'SN6829106938',
'invoice_number' => 'IN9036982986'
]);
$api_response = show_payment_details(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Amount: ' . $api_response['amount'] . '<br />';
echo 'Fee: ' . $api_response['handling_fee'] . '<br />';
echo 'Currency Code: ' . $api_response['currency_code'] . '<br />';
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| invoice_number | string | Unique invoice number that identifies the payment transaction in the system. |
| currency_code | string | Payment currency code (for example, USD for dollar, EUR for euro, USDT for Tether). |
| currency_symbol | string | Currency symbol (for example, "$" for US dollar). |
| external_number | string | External number associated with the payment transaction. |
| description | string | Payment transaction or invoice description. |
| amount | number | Payment amount in the specified currency. |
| handling_fee | number | Payment processing fee amount. |
| payment_status | string |
Payment status. Awaiting payment: pending Processing: in_processing Paid: paid Canceled: cancelled Expired: overdue Partially paid: partially Payment error: error Refund: refunded |
Create Transfer
This API method allows you to initialize a new transfer to an internal account in the Pay2.House system.
| Parameter | Type | Description |
|---|---|---|
| sender_account | string | Sender account. |
| recipient_account | string | Recipient account. |
| amount | number | Transfer amount. |
| comment | string | Transfer comment. |
<?php
function transfer_create($request_body = [])
{
$curl = curl_init('https://pay2.house/api/transfers/create');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'sender_account' => 'P2U49984694',
'recipient_account' => 'P2U93380055',
'amount' => 50,
'comment' => 'Transfer of funds to the client\'s account.'
]);
$api_response = transfer_create(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Payment successfully processed.';
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| transaction_number | string | Unique transfer number. |
Transfer Information
This API method allows you to get detailed information about a transfer, including status, amount, execution date and time, as well as other related data.
| Parameter | Type | Description |
|---|---|---|
| transaction_number | string | Unique transaction number used to identify a specific transfer. |
<?php
function transfer_details($request_body = [])
{
$curl = curl_init('https://pay2.house/api/transfers/details');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'transaction_number' => 'TN4395601712'
]);
$api_response = transfer_details(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Transaction Number: ' . $api_response['transaction_number'] . '<br />';
echo 'Status: ' . $api_response['transaction_status'] . '<br />';
echo 'Time Created: ' . $api_response['time_created'] . '<br />';
echo 'Date Created: ' . $api_response['date_created'] . '<br />';
echo 'Sender Account: ' . $api_response['sender_account'] . '<br />';
echo 'Recipient Account: ' . $api_response['recipient_account'] . '<br />';
echo 'Amount: ' . $api_response['amount'] . '<br />';
echo 'Fee Amount: ' . $api_response['fee_amount'] . '<br />';
echo 'Currency Code: ' . $api_response['currency_code'] . '<br />';
echo 'Payment Method: ' . $api_response['payment_method'] . '<br />';
echo 'Confirm Method: ' . $api_response['confirm_method'] . '<br />';
echo 'Payment Type: ' . $api_response['payment_type'] . '<br />';
echo 'Transaction Type: ' . $api_response['transaction_type'] . '<br />';
echo 'Comment: ' . $api_response['comment'] . '<br />';
echo 'Error Message: ' . $api_response['error_message'] . '<br />';
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| transaction_number | string | Unique transaction number. |
| time_created | number | Transaction creation time in Unix timestamp format. |
| date_created | string | Transaction creation date in YYYY-MM-DD format. |
| sender_account | string | Sender account number. |
| recipient_account | string | Recipient account number. |
| amount | number | Amount transferred in the transaction. |
| fee_amount | number | Fee amount charged for the transaction. |
| currency_code | string | Transaction currency code (for example, USD for dollar, EUR for euro, USDT for Tether). |
| payment_method | string |
Payment method used for this transaction. Pay2.House: house_money Push.House: push_house Cloaking.House: cloaking_house Capitalist.Net: capitalist Virtual Card Pay: virtual_card Visa Card Pay: visa Tether USDT: tether SWIFT: swift |
| confirm_method | string |
Transaction confirmation method. SMS confirmation: verification_phone Google Authenticator: verification_code API confirmation: verification_api No confirmation: none |
| payment_type | string |
Payment type. Internal transfer: transfer Account top-up: refill Currency exchange: exchange Invoice issuance: invoice Merchant API: merchant |
| transaction_type | string | Transaction type (incoming - credit, withdrawal - debit). |
| transaction_status | string |
Transaction status. Processing: in_processing Confirmed: confirmed Error: error |
| comment | string | Additional transaction information. |
| error_message | string | Error message if the transaction failed. |
Transfer History
This API method allows you to request a list of transactions, providing information about all completed transfers.
| Parameter | Type | Description |
|---|---|---|
| per_page | number | Number of records to be displayed on one page. |
| page | number | Page number for pagination. |
| transaction_type | string | Filter by transaction type (incoming - credit, withdrawal - debit). |
| status | string |
Filter by transaction status. Processing: in_processing Confirmed: confirmed Error: error |
| date_range | string | Filter for selection by date range (in DD.MM.YYYY - DD.MM.YYYY format), also used for filtering. |
<?php
function get_transfers($request_body = [])
{
$curl = curl_init('https://pay2.house/api/transfers');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'per_page' => 10,
'page' => 1,
'status' => 'confirmed'
]);
$api_response = get_transfers(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Count Transactions: ' . $api_response['count'] . '<br />';
if ( ! empty($api_response['transactions'])) {
foreach($api_response['transactions'] AS $item) {
echo '----------------------------------------';
echo 'Transaction Number: ' . $item['transaction_number'] . '<br />';
echo 'Status: ' . $item['transaction_status'] . '<br />';
echo 'Time Created: ' . $item['time_created'] . '<br />';
echo 'Date Created: ' . $item['date_created'] . '<br />';
echo 'Sender Account: ' . $item['sender_account'] . '<br />';
echo 'Recipient Account: ' . $item['recipient_account'] . '<br />';
echo 'Amount: ' . $item['amount'] . '<br />';
echo 'Fee Amount: ' . $item['fee_amount'] . '<br />';
echo 'Currency Code: ' . $item['currency_code'] . '<br />';
echo 'Payment Method: ' . $item['payment_method'] . '<br />';
echo 'Confirm Method: ' . $item['confirm_method'] . '<br />';
echo 'Payment Type: ' . $item['payment_type'] . '<br />';
echo 'Transaction Type: ' . $item['transaction_type'] . '<br />';
echo 'Comment: ' . $item['comment'] . '<br />';
echo 'Error Message: ' . $item['error_message'] . '<br />';
echo '----------------------------------------';
echo '<br />';
}
} else {
echo 'No Transactions Found.';
}
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| count | number | Total number of transactions matching the request. |
| transactions | array |
Array of transaction objects containing information about each transaction (for example, identifier, status, balance, etc.). See the description of all fields in the transfer information section. |
Get Account List
This API method allows you to request a list of all accounts associated with your account in the Pay2.House system.
| Parameter | Type | Description |
|---|---|---|
| delete_flag | number | Account deletion flag. The value 0 indicates an active account, and the value 1 indicates a deleted or blocked account. |
| currency_code | string | Currency code for filtering accounts (for example, "USD" for dollar, "EUR" for euro, "USDT" for Tether). |
<?php
function get_wallets($request_body = [])
{
$curl = curl_init('https://pay2.house/api/wallets');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'delete_flag' => 0,
'currency_code' => 'USD'
]);
$api_response = get_wallets(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Count Wallets: ' . $api_response['count'] . '<br />';
if ( ! empty($api_response['wallets'])) {
foreach($api_response['wallets'] AS $item) {
echo '----------------------------------------';
echo 'Account Number: ' . $item['account_number'] . '<br />';
echo 'Name: ' . $item['name'] . '<br />';
echo 'Time Created: ' . $item['time_created'] . '<br />';
echo 'Date Created: ' . $item['date_created'] . '<br />';
echo 'Balance: ' . $item['balance'] . '<br />';
echo 'Bonus: ' . $item['bonus'] . '<br />';
echo 'Currency Code: ' . $item['currency_code'] . '<br />';
echo 'Currency Symbol: ' . $item['currency_symbol'] . '<br />';
echo 'Address TRC20: ' . $item['trc20_address'] . '<br />';
echo '----------------------------------------';
echo '<br />';
}
} else {
echo 'No Wallets Found.';
}
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| count | number | Total number of accounts matching the request. |
| wallets | array |
Array of account objects containing information about each account (for example, identifier, status, balance, etc.). See the description of all fields in the account information section. |
Create Account
This API method allows you to create unique accounts that can be used for payments and transactions within the Pay2.House system.
| Parameter | Type | Description |
|---|---|---|
| name | string | Account name. |
| currency_code | string | Payment currency code (for example, USD for dollar, EUR for euro, USDT for Tether). |
<?php
function wallet_create($request_body = [])
{
$curl = curl_init('https://pay2.house/api/wallets/create');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'name' => 'Your Wallet Name',
'currency_code' => 'USD'
]);
$api_response = wallet_create(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Wallet created successfully.';
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| account_number | string | Created account number. |
Account Information
This API method allows you to request information about your account in the Pay2.House payment system.
| Parameter | Type | Description |
|---|---|---|
| account_number | string | Your account number. |
<?php
function wallet_details($request_body = [])
{
$curl = curl_init('https://pay2.house/api/wallets/details');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'account_number' => 'P2U49984694'
]);
$api_response = wallet_details(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Account Number: ' . $api_response['account_number'] . '<br />';
echo 'Name: ' . $api_response['name'] . '<br />';
echo 'Time Created: ' . $api_response['time_created'] . '<br />';
echo 'Date Created: ' . $api_response['date_created'] . '<br />';
echo 'Balance: ' . $api_response['balance'] . '<br />';
echo 'Bonus: ' . $api_response['bonus'] . '<br />';
echo 'Currency Code: ' . $api_response['currency_code'] . '<br />';
echo 'Currency Symbol: ' . $api_response['currency_symbol'] . '<br />';
echo 'Address TRC20: ' . $api_response['trc20_address'] . '<br />';
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| time_created | number | Account creation time in Unix timestamp format. |
| date_created | string | Account creation date in YYYY-MM-DD format. |
| delete_flag | number | Deletion flag (0 — not deleted, 1 — deleted). |
| account_number | string | Account number. |
| currency_code | string | Account currency code (for example, USD for dollar, EUR for euro, USDT for Tether). |
| currency_symbol | string | Currency symbol (for example, "$" for US dollar). |
| name | string | Account name. |
| balance | number | Current account balance. |
| bonus | number | Amount of bonus funds available on the account, if applicable. |
| trc20_address | string | TRC-20 address for tokens, if applicable. |
Get Account Statement
This API method allows you to get a detailed statement for the selected account, including information about all transactions and balance changes.
| Parameter | Type | Description |
|---|---|---|
| account_number | string | Your account number. |
<?php
function wallet_statement($request_body = [])
{
$curl = curl_init('https://pay2.house/api/wallets/statement');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'account_number' => 'P2U49984694'
]);
$api_response = wallet_statement(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
header('Location: ' . $api_response['download_url'], TRUE, 302);
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| download_url | string | URL for downloading the account statement file in CSV format. |
Get BIN List
This API method allows you to get a list of available BINs for issuing virtual cards in the Pay2.House system.
| Parameter | Type | Description |
|---|---|---|
| currency_code | string | BIN currency code (for example, USD, EUR). |
| country_code | string | BIN country code in ISO 3166-1 alpha-2 format (for example, US, HK). |
| card_type | string |
Card type. Virtual: virtual Physical: physical |
| card_network | string |
Payment system. Visa: visa MasterCard: mastercard |
| card_product_type | string |
Card product type. Personal: personal Standard: standard |
<?php
function cards_bins($request_body = [])
{
$curl = curl_init('https://pay2.house/api/cards/bins');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'currency_code' => 'USD',
'country_code' => 'HK',
'card_type' => 'virtual',
'card_network' => 'mastercard',
'card_product_type' => 'standard',
]);
$api_response = cards_bins(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Count Bins: ' . $api_response['count'] . '<br />';
if ( ! empty($api_response['bins'])) {
foreach($api_response['bins'] AS $item) {
echo 'BIN: ' . $item['bin'] . '<br />';
echo 'Currency Code: ' . $item['currency_code'] . '<br />';
echo 'Country Code: ' . $item['country_code'] . '<br />';
echo 'Card Type: ' . $item['card_type'] . '<br />';
echo 'Card Network: ' . $item['card_network'] . '<br />';
echo 'Card Product Type: ' . $item['card_product_type'] . '<br />';
echo 'Card Tier: ' . $item['card_tier'] . '<br />';
echo '3DS Support: ' . $item['is_3ds_supported'] . '<br />';
echo 'Verification Required: ' . $item['verification_required'] . '<br />';
echo '----------------------------------------';
echo '<br />';
}
} else {
echo 'No Bins Found.';
}
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| count | number | Total number of BINs matching the request. |
| bins | array | Array of BIN objects containing information about each BIN. |
| bin | string | Bank Identification Number. |
| currency_code | string | BIN currency code (for example, USD, EUR). |
| country_code | string | BIN country code in ISO 3166-1 alpha-2 format (for example, US, HK). |
| card_type | string | Payment system (for example, visa, mastercard). |
| card_product_type | string | Card product type (for example, standard, personal). |
| card_tier | string | Card level (for example, premium, shared). |
| verification_required | number | Whether verification is required (1 — yes, 0 — no). |
Get Card List
This API method allows you to request a list of virtual cards issued for your account in the Pay2.House system.
| Parameter | Type | Description |
|---|---|---|
| per_page | number | Number of records to be displayed on one page. |
| page | number | Page number for pagination. |
| status | string |
Filter by card status. Active: active Blocked: blocked Closed: closed Awaiting issuance: awaiting |
<?php
function get_cards($request_body = [])
{
$curl = curl_init('https://pay2.house/api/cards');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'per_page' => 10,
'page' => 1,
'status' => 'active'
]);
$api_response = get_cards(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Count Cards: ' . $api_response['count'] . '<br />';
if ( ! empty($api_response['cards'])) {
foreach($api_response['cards'] AS $item) {
echo '----------------------------------------';
echo 'Card Name: ' . $item['card_name'] . '<br />';
echo 'Card Number: ' . $item['card_number'] . '<br />';
echo 'Card ID: ' . $item['card_id'] . '<br />';
echo 'CVV: ' . $item['cvv'] . '<br />';
echo 'Expire Date: ' . $item['expiration_date'] . '<br />';
echo '3DS Password: ' . $item['password'] . '<br />';
echo 'Currency Code: ' . $item['currency_code'] . '<br />';
echo 'Currency Symbol: ' . $item['currency_symbol'] . '<br />';
echo 'Time Created: ' . $item['time_created'] . '<br />';
echo 'Date Created: ' . $item['date_created'] . '<br />';
echo 'Time Renewal: ' . $item['time_renewal'] . '<br />';
echo 'Date Renewal: ' . $item['date_renewal'] . '<br />';
echo 'Email: ' . $item['email'] . '<br />';
echo 'Phone Number: ' . $item['phone_number'] . '<br />';
echo 'Address Line 1: ' . $item['address_line_1'] . '<br />';
echo 'City: ' . $item['city'] . '<br />';
echo 'Country Code: ' . $item['country_code'] . '<br />';
echo 'Post Code: ' . $item['post_code'] . '<br />';
echo 'First Name: ' . $item['first_name'] . '<br />';
echo 'Last Name: ' . $item['last_name'] . '<br />';
echo 'Sur Name: ' . $item['sur_name'] . '<br />';
echo 'Date Birth: ' . $item['date_birth'] . '<br />';
echo 'Card Status: ' . $item['card_status'] . '<br />';
echo 'Balance: ' . $item['balance'] . '<br />';
echo 'Issuance Cost: ' . $item['issuance_cost'] . '<br />';
echo 'Renewal Cost: ' . $item['renewal_cost'] . '<br />';
echo 'Recharge Cost: ' . $item['recharge_cost'] . '<br />';
echo 'Recharge Type: ' . $item['recharge_type'] . '<br />';
echo 'Account Refund Cost: ' . $item['account_refund_cost'] . '<br />';
echo 'Account Refund Type: ' . $item['account_refund_type'] . '<br />';
echo 'Refund Min Amount: ' . $item['refund_min_amount'] . '<br />';
echo 'Min Recharge Amount: ' . $item['min_recharge_amount'] . '<br />';
echo 'Max Recharge Amount: ' . $item['max_recharge_amount'] . '<br />';
echo 'Block Status: ' . $item['block_status'] . '<br />';
echo 'Time Blocked: ' . $item['time_blocked'] . '<br />';
echo 'Date Blocked: ' . $item['date_blocked'] . '<br />';
echo '----------------------------------------';
echo '<br />';
}
} else {
echo 'No Cards Found.';
}
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| count | number | Total number of cards matching the request. |
| cards | array |
Array of card objects containing information about each card (for example, identifier, status, balance, etc.). See the description of all fields in the card information section. |
Issue Card
This API method allows you to issue a new virtual card in the Pay2.House system.
| Parameter | Type | Description |
|---|---|---|
| account_number | string | Your account number from which the card issuance fee will be charged. |
| first_name | string | Cardholder first name. |
| last_name | string | Cardholder last name. |
| sur_name | string | Cardholder middle name. |
| date_birth | string | Cardholder date of birth in DD.MM.YYYY format. |
| phone_number | string | Cardholder phone number, including country code. |
| address | string | Cardholder residential address. |
| city | string | Cardholder city of residence. |
| region | string | Cardholder region or state of residence. |
| post_code | string | Postal code for the residential address. |
| string | Cardholder email. | |
| country_code | string | Country code according to ISO 3166-1 alpha-2 standard (for example, "US" for the United States). |
| bin_number | string | Bank Identification Number (BIN) of the card. It must be requested through support tickets. |
| renewal_payment_flag | number | This flag indicates whether funds for card renewal may be charged from the main Pay2.House account if the card has insufficient funds (1 - yes, 0 - no). |
<?php
function card_issue($request_body = [])
{
$curl = curl_init('https://pay2.house/api/cards/issue');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'account_number' => 'P2U48633413',
'first_name' => 'John',
'last_name' => 'Doe',
'sur_name' => 'Smith',
'date_birth' => '01.01.1991',
'phone_number' => '+380990000000',
'address' => 'Kyiv, Ukraine',
'city' => 'Kyiv',
'region' => 'Kyiv',
'country_code' => 'UA',
'post_code' => '01001',
'email' => '[email protected]',
'bin_number' => '1122334455667788',
]);
$api_response = card_issue(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Card Number: ' . $api_response['card_number'] . '<br />';
echo 'Card ID: ' . $api_response['card_id'] . '<br />';
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| card_number | string | Issued card number. |
| card_id | string | Unique card identifier in the system, used for further operations. |
Card Information
This API method allows you to get detailed information about a virtual card, including card number, status, issue date, and other related data.
| Parameter | Type | Description |
|---|---|---|
| card_id | string | Unique card identifier in the system, used to get its details. |
<?php
function card_details($request_body = [])
{
$curl = curl_init('https://pay2.house/api/cards/details');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'card_id' => 'VC7914059264'
]);
$api_response = card_details(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Card Name: ' . $api_response['card_name'] . '<br />';
echo 'Card Number: ' . $api_response['card_number'] . '<br />';
echo 'Card ID: ' . $api_response['card_id'] . '<br />';
echo 'CVV: ' . $api_response['cvv'] . '<br />';
echo 'Expire Date: ' . $api_response['expiration_date'] . '<br />';
echo '3DS Password: ' . $api_response['password'] . '<br />';
echo 'Currency Code: ' . $api_response['currency_code'] . '<br />';
echo 'Currency Symbol: ' . $api_response['currency_symbol'] . '<br />';
echo 'Time Created: ' . $api_response['time_created'] . '<br />';
echo 'Date Created: ' . $api_response['date_created'] . '<br />';
echo 'Time Renewal: ' . $api_response['time_renewal'] . '<br />';
echo 'Date Renewal: ' . $api_response['date_renewal'] . '<br />';
echo 'Email: ' . $api_response['email'] . '<br />';
echo 'Phone Number: ' . $api_response['phone_number'] . '<br />';
echo 'Address Line 1: ' . $api_response['address_line_1'] . '<br />';
echo 'City: ' . $api_response['city'] . '<br />';
echo 'Country Code: ' . $api_response['country_code'] . '<br />';
echo 'Post Code: ' . $api_response['post_code'] . '<br />';
echo 'First Name: ' . $api_response['first_name'] . '<br />';
echo 'Last Name: ' . $api_response['last_name'] . '<br />';
echo 'Sur Name: ' . $api_response['sur_name'] . '<br />';
echo 'Date Birth: ' . $api_response['date_birth'] . '<br />';
echo 'Card Status: ' . $api_response['card_status'] . '<br />';
echo 'Balance: ' . $api_response['balance'] . '<br />';
echo 'Issuance Cost: ' . $api_response['issuance_cost'] . '<br />';
echo 'Renewal Cost: ' . $api_response['renewal_cost'] . '<br />';
echo 'Recharge Cost: ' . $api_response['recharge_cost'] . '<br />';
echo 'Recharge Type: ' . $api_response['recharge_type'] . '<br />';
echo 'Account Refund Cost: ' . $api_response['account_refund_cost'] . '<br />';
echo 'Account Refund Type: ' . $api_response['account_refund_type'] . '<br />';
echo 'Refund Min Amount: ' . $api_response['refund_min_amount'] . '<br />';
echo 'Min Recharge Amount: ' . $api_response['min_recharge_amount'] . '<br />';
echo 'Max Recharge Amount: ' . $api_response['max_recharge_amount'] . '<br />';
echo 'Block Status: ' . $api_response['block_status'] . '<br />';
echo 'Time Blocked: ' . $api_response['time_blocked'] . '<br />';
echo 'Date Blocked: ' . $api_response['date_blocked'] . '<br />';
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| card_name | string | Card name specified during issuance. |
| card_number | string | Issued card number. |
| card_id | string | Unique card identifier in the system. |
| cvv | string | Card security code required for authorization. |
| expiration_date | string | Card expiration date in MM/YY format. |
| password | string | 3DS password for additional security during online transactions. |
| currency_code | string | Currency code used for card operations. |
| currency_symbol | string | Currency symbol (for example: $ or €). |
| time_created | number | Card creation time in Unix timestamp format. |
| date_created | string | Card creation date in YYYY-MM-DD format. |
| date_renewal | string | Next card renewal charge date in YYYY-MM-DD format. |
| time_renewal | number | Next card renewal charge time in Unix timestamp format. |
| string | Email address specified during card issuance. | |
| phone_number | string | Phone number specified during card issuance. |
| address_line_1 | string | Residential address specified during card issuance. |
| city | string | City of residence specified during card issuance. |
| country_code | string | Country code according to ISO 3166-1 alpha-2 standard (for example, "US" for the United States). |
| first_name | string | Cardholder first name. |
| last_name | string | Cardholder last name. |
| sur_name | string | Cardholder middle name. |
| date_birth | string | Cardholder date of birth in DD.MM.YYYY format. |
| post_code | string | Postal code. |
| card_status | string |
Card status. Active: active Blocked: blocked Closed: closed Awaiting issuance: awaiting |
| balance | number | Current card balance. |
| issuance_cost | number | Card issuance cost. |
| renewal_cost | number | Card renewal cost. |
| recharge_cost | number | Card top-up fee. |
| recharge_type | string | Card top-up fee type (may be "fixed" for a fixed fee or "percent" for a percentage fee). The fee value is taken from the recharge_cost parameter. |
| account_refund_cost | number | Card refund fee. |
| account_refund_type | string | Card refund fee type (may be "fixed" for a fixed fee or "percent" for a percentage fee). The fee value is taken from the account_refund_cost parameter. |
| refund_min_amount | number | Minimum card refund amount. |
| min_recharge_amount | number | Minimum card top-up amount. |
| max_recharge_amount | number | Maximum card top-up amount. |
| block_status | string |
Card block status. Possible values can be found in the card block statuses section. |
| date_blocked | string | Card block date in YYYY-MM-DD format. |
| time_blocked | number | Card block time in Unix timestamp format. |
Card Top-Up
This API method allows you to top up the balance of a virtual card using your internal account.
Funds will be credited to the card within 2-3 minutes after the top-up request is created.
| Parameter | Type | Description |
|---|---|---|
| card_id | string | Identifier of the virtual card you want to top up. |
| account_number | string | Your internal account number from which the top-up amount will be debited. |
| amount | number | Amount you want to credit to the virtual card. |
<?php
function card_top_up($request_body = [])
{
$curl = curl_init('https://pay2.house/api/cards/top_up');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'card_id' => 'VC7914059264',
'account_number' => 'P2U48633413',
'amount' => 50
]);
$api_response = card_top_up(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Transaction Number: ' . $api_response['transaction_number'] . '<br />';
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| transaction_number | string | Transaction number associated with the card top-up. |
Card Refund
This API method allows you to initiate a refund from a virtual card to your internal account.
Funds are returned to the same account from which the card was issued.
You will receive the amount minus the refund fee, according to the card tariffs.
For example, if you make a refund of $10 and the refund fee is 3%, then $10 × 3% = $0.30 will be withheld as a fee, and $9.70 will be credited to your account.
| Parameter | Type | Description |
|---|---|---|
| card_id | string | Unique identifier of the card from which the refund is made. |
| amount | number | Refund amount to be transferred to the internal account. |
<?php
function card_refund($request_body = [])
{
$curl = curl_init('https://pay2.house/api/cards/refund');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'card_id' => 'VC7914059264',
'amount' => 10
]);
$api_response = card_refund(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Transaction Number: ' . $api_response['transaction_number'] . '<br />';
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| transaction_number | string | Unique transaction number associated with the completed refund from the card. |
Card Operation History
This API method provides access to the full list of operations performed with your virtual card.
| Parameter | Type | Description |
|---|---|---|
| card_id | string | Unique identifier of the virtual card for which you want to get the operation history. |
| per_page | number | Number of records to be displayed on one page. |
| page | number | Page number for pagination. |
<?php
function cards_history($request_body = [])
{
$curl = curl_init('https://pay2.house/api/cards/history');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'card_id' => 'VC7914059264',
'per_page' => 10,
'page' => 3
]);
$api_response = cards_history(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Count Transactions: ' . $api_response['count'] . '<br />';
if ( ! empty($api_response['transactions'])) {
foreach($api_response['transactions'] AS $item) {
echo 'Transaction Time: ' . $item['transaction_time'] . '<br />';
echo 'Transaction Number: ' . $item['transaction_number'] . '<br />';
echo 'Status: ' . $item['status'] . '<br />';
echo 'Type: ' . $item['type'] . '<br />';
echo 'Transaction Amount: ' . $item['transaction_amount'] . '<br />';
echo 'Transaction Currency Code: ' . $item['transaction_currency_code'] . '<br />';
echo 'Account Amount: ' . $item['account_amount'] . '<br />';
echo 'Account Currency Code: ' . $item['account_currency_code'] . '<br />';
echo 'Merchant Name: ' . $item['merchant_name'] . '<br />';
echo 'Merchant Url: ' . $item['merchant_url'] . '<br />';
echo 'Merchant Domain: ' . $item['merchant_domain'] . '<br />';
echo 'Merchant Icon Url: ' . $item['merchant_icon_url'] . '<br />';
echo 'Error Message: ' . $item['error_message'] . '<br />';
echo '----------------------------------------';
echo '<br />';
}
} else {
echo 'No Transactions Found.';
}
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| count | number | Total number of transactions in the operation history for this card. |
| transactions | array | List of objects containing details of each transaction, including date, amount, and operation type. |
Update Card Balance
This API method allows you to initiate a virtual card balance update, ensuring that up-to-date data about the current state of funds on the card is received.
| Parameter | Type | Description |
|---|---|---|
| card_id | string | Unique identifier of the virtual card for which you want to update the balance. |
<?php
function card_balance_refresh($request_body = [])
{
$curl = curl_init('https://pay2.house/api/cards/balance/refresh');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'card_id' => 'VC7914059264'
]);
$api_response = card_balance_refresh(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Card Balance: ' . $api_response['balance'] . '<br />';
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| balance | number | Current virtual card balance after the update, showing available funds. |
Card Confirmation Codes
This API method allows you to get a list of confirmation codes required to authorize operations with the virtual card.
| Parameter | Type | Description |
|---|---|---|
| card_id | string | Unique identifier of the virtual card for which operation confirmation codes are required. |
<?php
function card_confirmation_codes($request_body = [])
{
$curl = curl_init('https://pay2.house/api/cards/confirmation_codes');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'card_id' => 'VC7914059264'
]);
$api_response = card_confirmation_codes(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
if ( ! empty($api_response['codes'])) {
foreach($api_response['codes'] AS $item) {
echo 'Time Created: ' . $item['time_created'] . '<br />';
echo 'Date Created: ' . $item['date_created'] . '<br />';
echo 'Otp Code: ' . $item['otp_code'] . '<br />';
echo '----------------------------------------';
echo '<br />';
}
} else {
echo 'No Confirmation Codes Found.';
}
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
| codes | array | List of confirmation codes required to complete card transactions. |
Block Card
This API method allows you to block a virtual card, preventing its further use.
If there are funds on the card balance, they will be returned to the internal account from which the card was issued, according to the refund tariffs.
However, if the refund amount after deducting the fee is less than the minimum refund amount, such funds will be debited from the card balance.
| Parameter | Type | Description |
|---|---|---|
| card_id | string | Unique identifier of the virtual card you want to block. |
<?php
function cards_block($request_body = [])
{
$curl = curl_init('https://pay2.house/api/cards/block');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'card_id' => 'VC7914059264'
]);
$api_response = cards_block(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Card Blocked Successfully.';
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
Close Card
This API method allows you to close a virtual card, preventing its further use.
It is important to note that this method cannot be used to close a card if there are remaining funds on it.
| Parameter | Type | Description |
|---|---|---|
| card_id | string | Unique identifier of the virtual card you want to close. |
<?php
function card_close($request_body = [])
{
$curl = curl_init('https://pay2.house/api/cards/close');
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($request_body));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
$body = curl_exec($curl);
$info = curl_getinfo($curl);
curl_close($curl);
if ( ! empty($info['http_code']) && $info['http_code'] === 200) {
return json_decode($body, TRUE);
}
}
$sign_token = create_token([
'card_id' => 'VC7914059264'
]);
$api_response = card_close(['sign_token' => $sign_token, 'api_key' => 'YOUR_API_KEY']);
if ( ! empty($api_response['status'])) {
if ($api_response['status'] == 'success') {
echo 'Card Closed Successfully.';
} else {
echo 'Error Code: ' . $api_response['code'] . '<br />';
echo 'Error Message: ' . $api_response['msg'] . '<br />';
}
} else {
echo 'Unknown Error';
}
?>
Response parameters:
| Parameter | Type | Description |
|---|---|---|
| status | string | Request execution status (for example, "success" for a successfully completed request). |
| code | string | Response code (for example, "REQUEST_SUCCESS" for a successful request). |
Card Block Statuses
Description of possible card block statuses and their meanings.
| Status | Description |
|---|---|
| terms_violation | Violation of terms of use |
| insufficient_funds | Insufficient funds |
| unauthorized_topup | Unauthorized top-up attempts |
| high_refund_rate | High refund rate |
| prebilling | First billing |
| subscription_delay | Subscription fee delay |
| invalid_personal_data | Incorrect or incomplete personal data |
| illegal_activity | Attempts at illegal actions |
| verification_issues | Verification issues |
| high_risk | High risk level |
| terms_change | Change of card terms |
| inactivity | Inactivity |
| internal_errors | Internal errors |
| regulatory_requirements | Regulatory requirements |
| user_blocked | Client blocked the card |
| not_blocked | Not blocked |
Webhook Events
As soon as the payment status changes to "Paid", Pay2.House automatically sends webhook notifications to your preconfigured Webhook URL, which you configure for your merchant.
We will send the notification 100 times until we receive HTTP status 200 and the response text "OK".
In addition, our system automatically includes the "Pay2-House-Signature" parameter with a unique token in the request header. You can use this token to verify the authenticity of the request.
<?php
// Function for decoding webhook data
function decrypt_webhook($data = NULL, $secret_key = NULL)
{
$decoded_data = base64_decode($data);
if ($decoded_data === FALSE) {
return FALSE;
}
list($iv, $signature, $encrypted_data) = explode('|', $decoded_data);
$calculated_signature = hash_hmac('sha256', $iv . '|' . $encrypted_data, $secret_key);
if (hash_equals($calculated_signature, $signature)) {
$decoded_encrypted_data = openssl_decrypt(
base64_decode($encrypted_data),
'AES-256-CBC',
hex2bin(hash('sha256', $secret_key)),
0,
hex2bin(bin2hex(hex2bin($iv)))
);
if ($decoded_encrypted_data !== FALSE) {
return $decoded_encrypted_data;
}
}
return FALSE;
}
// Retrieving the webhook request body and decoding the JSON
$payload_body = file_get_contents('php://input');
$payload_decode = json_decode($payload_body, TRUE);
// Checking for the presence of a signature in the request header
if ( ! empty($_SERVER['HTTP_PAY2_HOUSE_SIGNATURE'])) {
// Decoding webhook data and outputting the decoded data
$decrypt_webhook = decrypt_webhook($_SERVER['HTTP_PAY2_HOUSE_SIGNATURE'], 'YOUR_API_KEY');
if ($decrypt_webhook !== FALSE) {
$webhook_decode = json_decode($decrypt_webhook, TRUE);
}
}
// Example print of $payload_decode and $webhook_decode
// Array
// (
// [invoice_number] => IN4063112032
// [external_number] => test
// [amount] => 10
// [handling_fee] => 0
// [currency_code] => EUR
// [description] => Test Payment for Pay2.House
// [status] => paid
// )
// Setting HTTP status 200 and terminating the script with the response text "OK"
http_response_code(200);
exit('OK');
?>
Possible Errors
Here are some of the possible errors that may occur when using the API.
| Error code | Error description |
|---|---|
| INVALID_TOKEN | Invalid or missing signature token. |
| INVALID_API_KEY | Invalid or missing API key. |
| API_KEY_NOT_FOUND | The specified API key was not found. |
| INACTIVE_API_KEY | The provided API key is inactive. |
| SIGNATURE_DECODING_FAILED | Error while decoding the signature. |
| INVALID_SIGNATURE_DATA | Invalid signature data. |
| EXPIRED_SIGNATURE | The signature has expired. |
| MISMATCHED_SIGNATURE_ISSUER | Invalid or missing Key ID. |
| INVALID_MERCHANT_ID | Invalid or missing Merchant ID. |
| MERCHANT_ID_NOT_FOUND | Merchant ID not found. |
| ACCESS_DENIED_MERCHANT | Access to the specified Merchant ID is denied. |
| INVALID_EXTERNAL_NUMBER | Invalid or missing external payment number. |
| INVALID_AMOUNT | Invalid amount. |
| INVALID_CURRENCY_CODE | Invalid currency code. |
| INVALID_DESCRIPTION | Invalid or missing payment description. |
| SIGNATURE_VERIFICATION_FAILED | Signature verification failed due to an error. |
| INVALID_RETURN_URL | Invalid or missing URL address for return after successful payment. |
| INVALID_CANCEL_URL | Invalid or missing URL address for payment cancellation. |
| INVALID_PAYER_EMAIL | Invalid client email address. |
| INVALID_COMMENT | Invalid or missing comment. |
| INSUFFICIENT_SENDER_BALANCE | Insufficient balance on the sender account. |
| AMOUNT_EXCEEDS_SENDER_BALANCE | Transfer amount exceeds the available balance on the sender account. |
| SENDER_ACCOUNT_NOT_FOUND | Sender account not found. |
| INVALID_SENDER_ACCOUNT | Invalid sender account. |
| RECIPIENT_ACCOUNT_NOT_FOUND | Recipient account not found. |
| INVALID_RECIPIENT_ACCOUNT | Invalid recipient account. |
| DIFFERENT_CURRENCY_CODES | Sender and recipient accounts have different currencies. |
| INVALID_TRANSFER | Sender and recipient accounts cannot be the same. |
| PROVIDER_NOT_FOUND | Payment method not found or inactive. |
| PROVIDER_OPTION_NOT_FOUND | Payment method options not found. |
| AMOUNT_BELOW_MINIMUM | Transfer amount is below the minimum threshold. |
| AMOUNT_EXCEEDS_MAXIMUM | Transfer amount exceeds the maximum limit. |
| INSUFFICIENT_BALANCE_AFTER_FEE | Insufficient balance on the sender account after accounting for the fee. |
| INVALID_NAME_WALLET | Invalid or missing account name. |
| INVALID_PAYMENT_METHOD | Invalid payment method. |
| PAY2_HOUSE_NOT_ENABLED | The Pay2.House payment method is not available for your merchant. |
| USDT_TRC20_NOT_ENABLED | The Tether USDT payment method is not available for your merchant. |
| CARDS_NOT_ENABLED | The CARDS payment method is not available for your merchant. |
| TRON_ACCOUNT_CREATION_ERROR | Error creating TRON account. |
| INVALID_INVOICE_NUMBER | Invalid account number format. |
| INVOICE_NOT_FOUND | Account not found. |
| MAX_WALLETS_REACHED | The maximum allowed number of accounts for your account has been reached. |
| MERCHANT_NOT_APPROVED | Merchant is not approved for payment processing. |
| INVALID_DEADLINE_SECONDS | Invalid payment expiration time interval value. |
| USER_DELETED | User has been deleted. |
| USER_BANNED | User is blocked. |
| USER_TEMPORARILY_BLOCKED | User is temporarily blocked. |
| USER_NOT_FOUND | User not found. |
| INVALID_PER_PAGE | Invalid value for the "per_page" parameter. The value must be from 10 to 100. |
| INVALID_PAGE | Invalid value for the "page" parameter. The value must be a positive integer. |
| INVALID_STATUS | Invalid status. |
| INSUFFICIENT_BALANCE | Insufficient funds on the account to perform this operation. |
| INVALID_FIRST_NAME | First name is specified incorrectly. |
| INVALID_LAST_NAME | Last name is specified incorrectly. |
| INVALID_SUR_NAME | Middle name is specified incorrectly. |
| INVALID_ADDRESS | Residential address is specified incorrectly. |
| INVALID_CITY | City of residence is specified incorrectly. |
| INVALID_REGION | Region of residence is specified incorrectly. |
| INVALID_POST_CODE | Postal code is specified incorrectly. |
| INVALID_EMAIL | Email is specified incorrectly. |
| INVALID_DATE_BIRTH | Date of birth is specified incorrectly. |
| FORBIDDEN_COUNTRY | Country is not allowed for use. |
| INVALID_PHONE_NUMBER | Phone number is specified incorrectly. |
| INVALID_COUNTRY_CODE | Country code is specified incorrectly. |
| VERIFICATION_REQUIRED | Account verification is required to perform the operation. |
| CARD_ISSUANCE_FAILED | Failed to issue the card. |
| INVALID_BIN_NUMBER | Invalid or missing BIN number. |
| ACCOUNT_NOT_FOUND | The specified account was not found. |
| INVALID_ACCOUNT_NUMBER | Invalid or missing account number. |
| CARD_NOT_FOUND | Card not found. |
| CARD_BLOCKED | Card is blocked. |
| CARD_CLOSED | Card is closed. |
| CARD_AWAITING | Card is being issued. |
| CARD_REFUND_FAILED | Refund from card failed. |
| CARD_BLOCKING_FAILED | Card blocking failed due to an internal system error. |
| CARD_DETAILS_FAILED | Failed to get card details. |
| CARD_BALANCE_NOT_ZERO | The card cannot be closed because there are remaining funds on it. |
| CARD_CLOSING_FAILED | Card closing failed due to an internal system error. |
| REFUND_NOT_ALLOWED | Refund is not allowed. |
| CARD_HAS_NO_BALANCE | The card has no balance. |
| CARD_REFUND_MIN_AMOUNT | Minimum refund amount has not been reached. |
| CARD_REFUND_MAX_AMOUNT | Refund amount exceeds the maximum limit. |
| CARD_REFUND_COST_GREATER | Refund amount after deducting the fee is less than the minimum allowed refund amount. |
| CARD_REFUND_AMOUNT_ZERO | Refund amount must be greater than zero. |
| ACCOUNT_DELETED | The specified account has been deleted. |
| CARD_MINIMUM_AMOUNT | Top-up amount must be above the minimum amount. |
| CARD_MAXIMUM_AMOUNT | Top-up amount exceeds the maximum allowed amount. |
| CARD_BALANCE_REFRESH_FAILED | Failed to update card balance. |
| CARD_HISTORY_REFRESH_FAILED | Failed to update card operation history. |
| SENDER_ACCOUNT_DELETED | Funds transfer is impossible because the sender account has been deleted or deactivated. |
| RECIPIENT_ACCOUNT_DELETED | Funds transfer is impossible because the recipient account has been deleted or deactivated. |
| TRANSACTION_NOT_PROCESSED | The transaction was not processed due to an error or internal restrictions. |
| TRANSACTION_NOT_FOUND | Transaction not found in the system. |
| INVALID_TRANSACTION_NUMBER | Invalid or missing transaction number. |
| INVALID_DATE_RANGE | An incorrect date range is specified. Check the format and logic correctness (the start date cannot be greater than the end date). |


