Creates a payment request. Once created, your customer can make a payment to the specified payment reference of yours. You can poll for PaymentStatus using getPaymentRequest to determine whether or not the required payment was made by the customer.
https://api.onepay.lk/v3/checkout/link/
Parameter | Type | Description |
---|---|---|
currency | String | The currency of the transaction (e.g., LKR, USD) |
app_id | String | The unique application identifier |
hash | String | A hash for securing the payment request |
amount | Number | The amount to be paid |
reference | String | A reference ID for the transaction |
customer_first_name | String | First name of the customer |
customer_last_name | String | Last name of the customer |
customer_phone_number | String | Customer's phone number |
customer_email | String | Customer's email address |
transaction_redirect_url | String | URL to redirect after transaction completion |
additionalData | String | Any additional data related to the transaction |
items | Array[item_ids] | This is optional field. pass any created item Id's |
Parameter | Type | Description |
---|---|---|
status | Number | Status code (e.g., 200 for a successful request) |
message | String | Descriptive message about the response |
data | Object | Contains details of the created payment request |
data.ipg_transaction_id | String | Unique IPG (In Payment Gateway) transaction ID |
data.amount | Object | Detailed breakdown of the transaction amounts |
data.amount.gross_amount | Number | Gross transaction amount |
data.amount.discount | Number | Discount applied (if any) |
data.amount.handling_fee | Number | Handling fee for the transaction |
data.amount.net_amount | Number | Net amount after discount and fees |
data.amount.currency | String | Currency code (e.g. LKR) |
data.gateway | Object | Information about the payment gateway |
data.gateway.redirect_url | String | URL to redirect the user for payment completion |
{
"currency": "LKR",
"app_id": "80NR1189D04CD635D8ACD",
"hash": "GR2P1189D04CD635D8AFD",
"amount": 100.00,
"reference": "7Q1M1187AE",
"customer_first_name": "Johe",
"customer_last_name": "Dohe",
"customer_phone_number": "+94771234567",
"customer_email": "viduladakshitha@gmail.com",
"transaction_redirect_url": "https://www.google.com.au",
"additionalData": "testing"
}
// Response will appear here after clicking Try it!
/*
Sample Successful Response:
{
"status": 200,
"message": "Successfully generate checkout link",
"data": {
"ipg_transaction_id": "XXXXXXXXXXXXXXXX",
"amount": {
"gross_amount": 100.00,
"discount": 0,
"handling_fee": 0,
"net_amount": 100.0,
"currency": "LKR"
},
"gateway": {
"redirect_url": "https://payment.onepay.lk/redirect/XXXXXXXXXX"
}
}
}
*/
Retrieves the status and details of an existing transaction using the transaction ID.
https://api.onepay.lk/v3/transaction/status/
Parameter | Type | Description |
---|---|---|
app_id | String | The unique application identifier |
onepay_transaction_id | String | The unique transaction identifier |
Parameter | Type | Description |
---|---|---|
status | Number | Status code of the response (e.g., 200 for success) |
message | String | Response message indicating the result of the operation |
data | Object | Contains the transaction details |
data.ipg_transaction_id | String | The unique transaction identifier |
data.currency | String | Currency code of the transaction |
data.amount | Number | Amount of the transaction |
data.transaction_request_datetime | String | Date and time when the transaction was requested |
data.status | Boolean | Payment status of the transaction |
data.paid_on | String|null | Date and time when the payment was made, null if not paid |
{
"app_id": "37JR1187AEA68DE9D6D84",
"onepay_transaction_id": "4RDJ1187BEA110906A6A1"
}
{
"status": 200,
"message": "Successfully get transaction status",
"data": {
"ipg_transaction_id": "4RDJ1187BEA110906A6A1",
"currency": "LKR",
"amount": 435.26,
"transaction_request_datetime": "2021-10-05 11:16:42",
"status": false,
"paid_on": null
}
}
Creates an item in the system. Provide the item details such as name, description, price, currency, image URL and metadata.
http://api.onepay.lk/v3/item/
Parameter | Type | Description |
---|---|---|
name | String | Name of the item |
description | String | Description of the item |
price | Number | Price of the item |
currency | String | Currency code for the price (e.g., USD, LKR) |
image_url | String | URL of the item's image |
metadata | Object | Additional metadata about the item (custom key-value pairs) |
Parameter | Type | Description |
---|---|---|
status | Number | Status code of the response (e.g., 200 for success) |
message | String | Response message indicating the result of the operation |
data | Object | Contains the response data |
data.item_id | String | Unique identifier for the created item |
{
"name": "Desktop",
"description": "Work Laptop",
"price": 1400.99,
"currency": "USD",
"image_url": "https://example.com/laptop.jpg",
"metadata": {
"brand": "Dell",
"processor": "Intel i5",
"RAM": "16GB"
}
}
// Response will appear here after clicking Try it!
Retrieves a list of items from the system with their details including metadata.
https://api.onepay.lk/v3/item/
Parameter | Type | Description |
---|---|---|
status | Number | Status code of the response (e.g., 200 for success) |
message | String | Response message indicating the result of the operation |
data | Array | Array of item objects |
data[].item_id | String | Unique identifier for the item |
data[].name | String | Name of the item |
data[].description | String | Description of the item |
data[].price | String | Price of the item |
data[].currency | String | Currency code for the price |
data[].image_url | String | URL of the item's image |
data[].is_deleted | Boolean | Indicates if the item has been deleted |
data[].metadata | Array | Array of metadata objects for the item |
data[].metadata[].key | String | Key of the metadata property |
data[].metadata[].value | String | Value of the metadata property |
data[].metadata[].is_deleted | Boolean | Indicates if the metadata property has been deleted |
// Response will appear here after clicking Try it!
Updates an existing item in the system with new details such as name, description, price, currency, image URL and metadata.
https://api.onepay.lk/v3/item/{item_id}/
Parameter | Type | Description |
---|---|---|
item_id | String | The unique identifier of the item to update |
Parameter | Type | Description |
---|---|---|
name | String | Name of the item |
description | String | Description of the item |
price | Number | Price of the item |
currency | String | Currency code for the price (e.g., USD, LKR) |
image_url | String | URL of the item's image |
metadata | Object | Additional metadata about the item (custom key-value pairs) |
Parameter | Type | Description |
---|---|---|
status | Number | Status code of the response (e.g., 200 for success) |
message | String | Response message indicating the result of the operation |
data | Object | Contains the response data |
data.item_id | String | Unique identifier of the updated item |
{
"name": "Laptop",
"description": "Gaming Laptop",
"price": 1600,
"currency": "USD",
"image_url": "https://example.com/laptop.jpg",
"metadata": {
"brand": "hp",
"processor": "Intel i7",
"RAM": "16GB"
}
}
{
"status": 200,
"message": "Successfully update item",
"data": {
"item_id": "item_57f132843c"
}
}
Deletes an existing item from the system using its unique identifier.
https://api.onepay.lk/v3/item/{item_id}/
Parameter | Type | Description |
---|---|---|
item_id | String | The unique identifier of the item to delete |
Parameter | Type | Description |
---|---|---|
status | Number | Status code of the response (e.g., 200 for success) |
message | String | Response message indicating the result of the operation |
{
"status": 200,
"message": "Successfully deleted item"
}