Introduction

The API was designed for integration with the OYF Payment Gateway. The bird's eye view on main API integration business-process is straight-forward:

  • You have to get the Supported currency, Which you have already linked your wallet with the OYF portal.
  • After that make payment request using currency uuid and other detail
  • Check Order Status

In cases of prolongation, cancellation, or other order parameter change you have to make a new request about its new value by corresponding API request.

Basic concepts

Authentication

All requests must be authenticated.

In order to make an authenticated request, please include a header containing your token as follows: X-Authorization : YOUR_TOKEN The token is provided to the user associated with the Partner. One user - one token.

To get a test account with API token - please - contact the dev@oyf.io or contact the sales team.

Permissions

Privileges are an internal mechanism for restricting user actions. The set of privileges is given to the user during account creation and determines the actions that he is allowed to do. In an integration context, you will only encounter privileges when you get "permission denied" error.

Requests

All requests should be made using the HTTPS protocol so that traffic is encrypted.

When passing parameters in a Post request, parameters must be passed as a form object containing attribute names and values as key-value pairs.

Responses

All the responses will be JSON structures (Except file downloading). The API aim to conform to the Restful concept. All meaningful information is passed in the BODY of response. API only supports GET and Post requests.

Getting the Currency

CURL Request

$apiURL = 'https://live.oyf.io/api/payment/get-currencies-list';
$secret_key = 'aij3vg2bmucgbzrkgzsfgkenaabhdf8be81mgzz7yj38787rav8ai';
$profile_id = 'c83821798-286c-0007-bb29-2ce849e0de10';
$curl = curl_init($apiURL);
curl_setopt($curl, CURLOPT_URL, $apiURL);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
'Content-Type: application/json',
'X-Authorization:' . $secret_key
);
curl_setopt($curl, CURLOPT_HTTPHEADER,$headers);
$data['profile_id'] = $profile_id;
$data= json_encode($data);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Response

{
"_metadata": {
"outcome": "SUCCESS",
"outcomeCode": 200,
"numOfRecords": 1,
"message": "Currency list"
"records": [
{
"uuid": "c7b5e721-72c3-4222-b2c4-d4a244daa1ae",
"name": "Tether Test",
"network_type": "BEP20",
"logo": "https://dhsf9xmf10p0r.cloudfront.net/oyf/uploads/1684244567-Group%201000004067.png",
}
],
"errors": []
}

Make Payment (Order)

CURL Request

$apiURL = 'https://live.oyf.io/api/payment/make-payment';
$secret_key = 'aij3vg2bmucgbzrkgzsfgkenaabhdf8be81mgzz7yj38787rav8ai';
$profile_id = 'c83821798-286c-0007-bb29-2ce849e0de10';
$postInput = [
'currency_id' => 'c7b5e721-72c3-4222-b2c4-d4a244daa1ae',
'name' => 'John Doe',
'email' => 'johndoe@example.com',
'phone' => '(415) 555‑0132',
'address' => "N/A",
'issued_date' => '2023-10-23',
'inv_description' => 'Testing Order',
'invoice_type' =>"S",
'subtotal' =>'100',
'subtotal_discount' => "0",
'grand_total' => '100',
'profile_id' => $profile_id,
'callback' => 'www.example.com/return-url',
'cart_id' => '231123',
];
$curl = curl_init($apiURL);
curl_setopt($curl, CURLOPT_URL, $apiURL);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
'Content-Type: application/json',
'X-Authorization:' . $secret_key
);
curl_setopt($curl, CURLOPT_HTTPHEADER,$headers);
$data= json_encode($postInput);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Form Object

Key

Value

Description

currency_id

cd3b5f06-7a00-4513-bbd3-ea8118f1326a

Required

name

Test User

Optional / Nullable

email

test@oyf.io

Optional / Nullable

phone

+(508) 646-2869

Optional / Nullable

address

test address

Optional / Nullable

issued_date

2023-04-06

Required

inv_description

Testing Invoice descriotions

Optional / Nullable

invoice_type

S

S => Sale , R => Recursion (Required)

subtotal

85

Optional / Nullable

subtotal_discount

0

Optional / Nullable

vat_tax

5

Optional / Nullable

grand_total

90

Required

profile_id

04d66e00-8617-4d43-938e-5326f1442897

Required

success_return_url

https://test.com/payment-confirmation

Required

failed_return_url

https://test.com/payment-confirmation

Required

cart_id

7567557687

Required

Response

{
"_metadata": {
"outcome": "SUCCESS",
"outcomeCode": 200,
"numOfRecords": 1,
"message": "Invoice created successfully!."
"records": "https://portal.oyf.io/payment-page/gWqbhRMH1V4cNSDd8O92,"
"errors": []
}

Get Order Status

CURL Request

$secret_key = 'aij3vg2bmucgbzrkgzsfgkenaabhdf8be81mgzz7yj38787rav8ai';
$profile_id = 'c83821798-286c-0007-bb29-2ce849e0de10';
$apiURL = 'https://live.oyf.io/api/payment/get-order-status';
$postInput = [
'trx_number' => 'TRX0283',
'cart_id' => '231123',
'profile_id' => $profile_id,
];
$curl = curl_init($apiURL);
curl_setopt($curl, CURLOPT_URL, $apiURL);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
'Content-Type: application/json',
'X-Authorization:' . $secret_key
);
curl_setopt($curl, CURLOPT_HTTPHEADER,$headers);
$data= json_encode($postInput);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Response

{
"_metadata": {
"outcome": "SUCCESS",
"outcomeCode": 200,
"numOfRecords": 1,
"message": "Currency list"
"records": [
{
"return_url": "https://test.com/api/payment ",
"transection_hash":
"0x9231263dd800c51fb3a256eb213d8fd43b4b50974dc1b902f8493ea99fbab37e",
"logo": "https://dhsf9xmf10p0r.cloudfront.net/oyf/uploads/1684244567-Group%201000004067.png",
"cart_id": "756755768",
"invoice_price": "90.00",
"payment_status": "success",
"blockchain_link_with_transection_hash": "https://testnet.bscscan.com/tx/0x9231263dd800c51fb3a256eb213d8fd43b4b50974dc1b902f8493ea99fbab37e",
"paid_at": "2023-06-08 14:34:11",
"message": ""
},
"errors": []
}