API Access Information
You can get HUAWEIPIN API access information from your store panel. Parameters:
Parameter Name |
Description |
merchant_apikey |
Your API Key |
merchant_secretkey |
Your Secret Key |
merchant_oid |
Unique order number |
client_username |
The user's name in your system |
client_ip |
User's IP address |
Successful API response
200 SUCCESS
{
"isSuccess": true,
"code": 200,
"errorMeesage": "Payment channel has been created.",
"iframeUrl": "https://payment.huaweigiftcard.org/Payment/?Token=[ORDER_TOKEN]"
}
Error Codes
Response Codes & Descriptions
Code |
Description |
302 |
merchant_apikey cannot be empty |
303 |
merchant_secretkey cannot be empty |
304 |
merchant_oid Order Number is unique and cannot be left blank. |
305 |
client_username cannot be empty |
306 |
Your API information is incorrect |
Parametreler
Request data must be JSON
type
POST/
Parameters
Name |
Type |
Required |
Description |
merchant_apikey |
string |
Yes |
Store Api-Key (Will be obtained from the store panel) |
merchant_secretkey |
String |
Yes |
Store Secret-Key (Will be obtained from the store panel) |
merchant_oid |
String |
Yes |
Unique order number |
client_username |
String |
Yes |
Username or Number on your system. |
client_ip |
String |
Yes |
User's IP address on your system. |
Response:
Check Success Response, Errors
Sample Code
PHP Code
$requestModel = array(
'merchant_apikey' => 'your_api_key',
'merchant_secretkey' => 'your_secret_key',
'merchant_oid' => '123456789', // An example order ID
'user_name' => '127.0.0.1', // An example IP address
'client_ip' => 'customer123', // An example username
);
$apiUrl = 'https://payment.huaweigiftcard.org/api/v1/GetFrame';
$ch = curl_init($apiUrl);
// Set JSON data as POST request
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestModel));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
// Receive response from the server
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute the POST request
$response = curl_exec($ch);
// Error handling
if (curl_errno($ch)) {
echo 'Curl Error: ' . curl_error($ch);
}
// Close the Curl connection
curl_close($ch);
// Process the response from the server
echo 'API Response: ' . $response;
Sample Code
C# Code
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
class Program
{
static async Task Main()
{
var requestModel = new DepositRequestModel
{
merchant_apikey = "your_api_key",
merchant_secretkey = "your_secret_key",
merchant_oid = "123456789", // An example order ID
client_ip = "127.0.0.1", // An example IP address
user_name = "customer123", // An example username
};
var apiUrl = "https://payment.huaweigiftcard.org/api/v1/GetFrame";
using (var httpClient = new HttpClient())
{
var jsonContent = new StringContent(JsonConvert.SerializeObject(requestModel), Encoding.UTF8, "application/json");
HttpResponseMessage response = await httpClient.PostAsync(apiUrl, jsonContent);
if (response.IsSuccessStatusCode)
{
var responseContent = await response.Content.ReadAsStringAsync();
var apiResponse = JsonConvert.DeserializeObject(responseContent);
Console.WriteLine("API Response Code: " + apiResponse.Code);
Console.WriteLine("API Response Message: " + apiResponse.ErrorMeesage);
Console.WriteLine("Iframe URL: " + apiResponse.IframeUrl);
}
else
{
Console.WriteLine("API Response Error: " + response.StatusCode);
}
}
}
}
public class CashInFrameModel
{
public string merchant_apikey { get; set; }
public string merchant_secretkey { get; set; }
public string merchant_oid { get; set; }
public string client_username { get; set; }
public string client_ip { get; set; }
}
public class CashInFrameResponseModel
{
public bool IsSuccess { get; set; }
public int Code { get; set; }
public string? ErrorMeesage { get; set; }
public string? IframeUrl { get; set; }
}
Parametreler
Request data must be JSON
type
Callback parameters will be sent to the CallBackUrl address specified in your Store panel by the HUAWEIPIN system. The system will retry the callback process every 10 minutes until it receives a "Successful" response. To facilitate the integration process, you can track API transactions from the Merchant Panel > API > Transactions page.
POST/
Parameters
Name |
Type |
Required |
Description |
merchant_oid |
string |
Yes |
Order Number. |
merchant_callback_privatekey |
string |
Yes |
Store CallBack-Key (Will be obtained from the store panel). |
status |
String |
Yes |
Transaction state. |
amount |
Intager |
Yes |
Order Amount. |
hash |
String |
Yes |
hash = SHA256(merchant_oid + amount + merchant_callback_privatekey) |
Response:
Check Success Response, Errors
Sample Code
PHP Code
echo "OK";
Sample Code
C# Code
Return Ok("Write your message.");