Skip to content
API Docs
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Readme.md

Readme.md

xPay-Platform-SDK

Usage

The xPay SDK Platform is used to withdraw users' funds from the platform to their xPay wallets. To start sending commission payments from the platform, you should request your Platform Keys from an administrator. Users sign up on the platform and add their xpay wallet address in the profile settings. The platform must use MyXPay API to send withdrawal requests.

API Reference

MyXPay API is organized around REST. Our API has predictable resource-oriented URLs, returns JSON-encoded responses.

Request

Create Withdraw Request

Param Description
URL https://myxpay.net/api/v2/platform/withdraw/
Method POST
Content-Type application/json

Request Data Params:

Param Description
api_key your Platform API Key
address users xPay wallet address
amount amount in xPay with cents
signature calculated signature for callback validation
description optional operation description(doesn't appear in the signature)

Request example:

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"api_key":"1555830491-J64JlACG5Fnpl2o5L19hxb-FpGJdbmJ","address":"yJuay1EqAsXyI68CS9f1z10noakvt3LPx7kiozxgdmFc7tuVfExRBbr9v6AfEMqc","amount":"12.65","signature":"ab4fd93ec144dc7545908c4b9710f96c0833f5f5d035fd99958e30c77af58d72","description":"optional"}' \
  https://myxpay.net/api/v2/platform/withdraw/

Signature

The platform needs to sign requests according to the specified signature method. Any data sent in this way can be used safely. To verify sent withdrawal requests, API validates the signature on the backend. To create a signature, follow this example:

Python 3
# to create signature join api_key, address, amount and api_secret and make sha256 hash

from hashlib import sha256
api_key = "Your Platform API Key"
address = "Users xPay wallet address"
amount = "xPay amount with two digits"
api_secret = "Your Platform Secret Key"
raw_sign = f"{api_key}{address}{amount}{api_secret}"
signature = sha256(raw_sign.encode('ascii')).hexdigest()
print(signature)
PHP
<?php
// to create signature join api_key, address, amount and api_secret and make sha256 hash

$apiKey = "Your Platform API Key";
$userWallet = "Users xPay wallet address";
$amount = "xPay amount with two digits";
$apiSecret = "Your Platform Secret Key";
$calculatedSignature = hash("sha256", $apiKey . $userWallet . sprintf("%.02f", round($amount, 2)) . $apiSecret);
echo $calculatedSignature;

Response

API response consists of status and error, if it exists. The following responses are available:

Status Response
Success {'status': 1, 'withdraw_id': '44'}
Error {'status': 0, 'error': 'Wrong signature'}
Error {'status': 0, 'error': 'Wrong API KEY - platform not found'}
Error {'status': 0, 'error': 'Wrong address - wallet not found'}
Error {'status': 0, 'error': 'Wrong amount format'}
You can’t perform that action at this time.