FokawaPay is a secure peer-to-peer e-wallet payment service that offers businesses and individuals a time-saving, cost-effective solution.For instant worldwide cryptocurrency transfers, available 24
Common Uses for FokawaPay: Webmasters, Freelancers, Webcam Models, Developers, Independent Contractors, Advertising Networks, Affiliate Programs, Live Streaming Networks, Freelance Companies, Hosting Providers, Billing and Payment Processors, Webcam Studios, iGaming Sites & Others.
FokawaPay offers instant crypto transfers from your Fokawa.com balance to merchant wallets. To apply, please contact support@fokawa.com.
import hashlib
import hmac
import json
import requests
from datetime import datetime
import uuid
# Configuration variables
secret = 'dz3WhB9z7JpYdkRzjvJt'
merchant_id = 'demo'
api_url = 'https://payments.fokawa.com/apiv2/payment/'
# Payload data
data = {
"order_id": f"orderId-{uuid.uuid4()}",
"amount": "200",
"currency_code": "PHP",
"merchant_id": merchant_id,
"return_url": "https://www.google.com/",
"notification_url": "https://www.google.com/",
"payCoinSymbol": "tether",
"date_created": datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
"email": "yahoo@gmail.com"
}
# Function to generate signature
def generate_signature(merchant_id, json_payload, secret):
message = merchant_id + json_payload + secret
return hmac.new(secret.encode(), message.encode(), hashlib.sha256).hexdigest()
# Generate signature and add to payload
data['signature'] = generate_signature(merchant_id, json.dumps(data, separators=(',', ':')), secret)
# Make the HTTP POST request
headers = {
'Content-Type': 'application/json'
}
response = requests.post(api_url, headers=headers, data=json.dumps(data))
# Handle the response
if response.status_code == 200:
response_data = response.json()
if 'payment_url' in response_data:
print(f"Redirecting to: {response_data['payment_url']}")
# In a real web app, you would redirect the user to the payment URL
else:
print('Error: Payment URL not found in the response.')
else:
print('Error: Failed to connect to the payment gateway.')
print('HTTP Status:', response.status_code)
print('Response:', response.text)
const secret = 'dz3WhB9z7JpYdkRzjvJt';
const merchant_id = 'demo';
const api_url = 'https://payments.fokawa.com/apiv2/payment/';
// Generate order ID and current date
const order_id = `orderId-${Date.now()}`;
const date_created = new Date().toISOString().slice(0, 19).replace('T', ' ');
// Payload data
const data = {
order_id: order_id,
amount: "200",
currency_code: "PHP",
merchant_id: merchant_id,
return_url: "https://www.google.com/",
notification_url: "https://www.google.com/",
payCoinSymbol: "tether",
date_created: date_created,
email: "yahoo@gmail.com"
};
// Function to generate HMAC SHA256 signature
function generateSignature(merchant_id, json_payload, secret) {
const message = merchant_id + json_payload + secret;
return CryptoJS.HmacSHA256(message, secret).toString(CryptoJS.enc.Hex);
}
// Generate signature and add to payload
data.signature = generateSignature(merchant_id, JSON.stringify(data, null, 0), secret);
// Function to make the HTTP POST request
async function makePaymentRequest(api_url, data) {
const response = await fetch(api_url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
if (response.ok) {
const responseData = await response.json();
if (responseData.payment_url) {
window.location.href = responseData.payment_url;
} else {
console.error('Error: Payment URL not found in the response.');
}
} else {
console.error('Error: Failed to connect to the payment gateway.');
console.error('HTTP Status:', response.status);
const responseText = await response.text();
console.error('Response:', responseText);
}
}
// Make the payment request
makePaymentRequest(api_url, data);
Response
Response Payload
The response payload will be a JSON object containing the following fields:
Field
Type
Description
order_id
string
Unique identifier for the order. Matches the order_id in the request.
payment_url
string
URL where the consumer can complete the payment.
payment_id
string
Unique identifier for the payment transaction.
Payment Callback
This API documentation describes the process of sending a callback to a merchant's notification URL after processing a payment.
Endpoint
POST: {notification_url}
Request Headers
Content-Type: application/json
Request Body
The request body is a JSON object containing the following fields:
The status of the order, which is always "PAID" for successful payments.
orderNum
string
The unique identifier for the order provided by the payment processor.
order_id
string
The unique identifier for the order provided by the merchant.
currency_amount
string
The total amount paid by the consumer.
currency_code
string
payAmount
string
The amount paid in the transaction.
coin
string
The cryptocurrency symbol used for the payment.
sign
string
A signature generated to verify the authenticity of the callback.
Signature Generation
The sign field is generated using the generate_signature_to_merchant function. This function requires the merchant's ID, the JSON encoded response_data, and the merchant's secret key.
Ensure the merchant_id, secret, and other sensitive data are stored securely and not exposed in client-side code.
The return_url and notification_url should be properly configured to handle the payment status and notifications.
This documentation provides the necessary details to integrate the Fokawa Payments API, including payload structure, signature generation, and expected response to ensure secure transactions.
Withdrawal
This API endpoint allows merchants to initiate a withdrawal request from their Fokawa account.