TygaPay Docs
  • ๐Ÿ‘‹Welcome!
  • ๐Ÿ›’Payment Gateway
    • ๐Ÿ’กHow It Works
    • โ„น๏ธGet Started
  • API
    • ๐Ÿš€API Integration Setup
      • ๐Ÿ”Authentication
      • โ†—๏ธRequests
    • ๐Ÿ“ฆAPIs
      • ๐Ÿ“–Swagger Docs
      • ๐ŸฆTenants
      • ๐Ÿ˜„Users
      • โ†”๏ธTransactions
      • ๐ŸงพOrders
  • Plugins
    • ๐Ÿ›๏ธWooCommerce
      • ๐Ÿ”‘API Credentials
      • ๐Ÿ› ๏ธIntegration
  • Admin Portal
    • โชRefunds
      • โฎ๏ธPaid Order Refunds
      • โ—€๏ธPartial Paid Order Refunds
      • โ—€๏ธOverpaid Order Refunds
Powered by GitBook
On this page
  1. API
  2. APIs

Orders

API's to manage Orders.

PreviousTransactionsNextWooCommerce

Last updated 9 months ago

Production URL:

Create Order

Please Note: If you want to pre-populate user data for the Stripe Onramp payment feature - Please ensure to add the customerInformation object data.

Order Notify Url (Webhook)

WARNING: Ensure that your system accepts payments ONLY when the status of the notifyUrl request is "success".

Order Completed Notify Url

POST https://your-notify-url

Request Body

Name
Type
Description

orderId*

string

TygaPay Order Id.

orderNumber*

string

Unique Order Number .

status*

string

Status of the order upon completion:

success: Payment has been successfully processed.

expired: The order has expired.

cancelled: The order has been cancelled.

date*

string

Order complettion date. i.e

2024-01-07T19:05:30.175Z

amount

number

The paid amount. Amount will only be present if the status is equal to success.

currency

string

i.e USDT, KRU etc Currency will only be present if the status is equal to success.

txId

String

The payment TygaPay txId. TxID will only be present if the status is equal to success.

Order Redirect Url

When an order receives a final outcome, the Payment Gateway will redirect to the specified redirect URL. The redirect URL will have the following parameters appended: ?orderId=[ORDER_ID]&orderNumber=[ORDER_NUMBER]&status=[STATUS]

i.e https://your-redirect-url?orderId=004Qs494RxpEMFYUyXBz&orderNumber=323421&status=success

Fields
Description

ORDER_ID

The TygaPay Order Id

ORDER_NUMBER

The orderNumber supplied in the creation of the order.

STATUS

Status of the order upon completion:

success: Payment has been successfully processed.

expired: The order has expired.

cancelled: The order has been cancelled.

Note: TygaPay will accommodate the specific format required for your redirect URL.

Get Order

Cancel Order

Refund Order to TygaPay Account

Refund Order to Crypto Address

  • To process a refund to a cryptocurrency address, an OTP (One-Time Password) is necessary. Please reach out to support@tygapay.com to set up the Tenant Admin account that will receive these OTPs.

Refund NotifyUrl Request (Webhook)

POST https://your-refund-notify-url

Request Body

Name
Type
Description

type*

string

order_refund | order_refund_crypto

orderId*

string

TygaPay Order Id.

orderNumber*

string

Unique Order Number .

status*

string

Status of the order refund upon completion:

refunded: Order has been refunded successfully.

date*

string

Order complettion date. i.e

2024-01-07T19:05:30.175Z

amount*

number

The refunded amount.

currency*

string

The refunded currency. i.e USDT

txId*

string

The payment TygaPay txId.

thirdPartyId

string

The specified thirdPartyId is used to initiate the refund request.

address

string

The address to which the refunded amount was sent. This address is provided when the type is order_refund_crypto.

token

string

The token, such as USDT, that has been transferred to the blockchain address.

network

string

The network used to transmit the token.

txHash

string

The blockchain transaction ID, which can be used to verify the legitimacy of the transfer.

๐Ÿ“ฆ
๐Ÿงพ
https://orders-v1-api-rdqehkur6a-ey.a.run.app

Retrieves an order by Id.

get
Path parameters
orderIdstringRequired

Id of the order to retrieve.

Header parameters
x-api-keystringRequired

Your unique API Key.

x-api-hashstringRequired

Your API Hash.

Responses
200
Order successfully retrieved.
application/json
401
Unauthorized access.
404
Order not found.
500
Internal server error.
get
GET /orders HTTP/1.1
Host: 
x-api-key: text
x-api-hash: text
Accept: */*
{
  "message": "text",
  "data": {
    "id": "text",
    "orderNumber": "text",
    "name": "text",
    "description": "text",
    "amount": 1,
    "amountPaid": 1,
    "amountDue": 1,
    "status": "new",
    "state": "pending",
    "email": "text",
    "notifyUrl": "text",
    "returnUrl": "text",
    "createdDate": "text",
    "modifiedDate": "text"
  }
}

Cancels an order by Id.

put
Path parameters
orderIdstringRequired

Id of the order to cancel.

Header parameters
x-api-keystringRequired

Your unique API Key.

x-api-hashstringRequired

Your API Hash.

Responses
200
Order successfully canceled.
application/json
400
Invalid status to cancel.
401
Unauthorized access.
404
Order not found.
500
Internal server error.
put
PUT /orders/:orderId/cancel HTTP/1.1
Host: 
x-api-key: text
x-api-hash: text
Accept: */*
{
  "message": "text",
  "data": {
    "orderId": "text",
    "status": "new"
  }
}

Send a refund OTP to the tenant admin's account.

post
Path parameters
orderIdstringRequired

The unique identifier of the order for which the refund is to be processed.

Header parameters
x-api-keystringRequired

Your unique API Key.

x-api-hashstringRequired

Your API Hash.

Responses
200
Order Refund OTP has been sent successfully.
application/json
400
Invalid request body.
401
Unauthorized access.
404
Order not found.
500
Internal server error.
post
POST /orders/:orderId/refund/crypto/otp HTTP/1.1
Host: 
x-api-key: text
x-api-hash: text
Accept: */*
{
  "message": "text"
}

Refunds an order by Id.

post
Header parameters
x-api-keystringRequired

Your unique API Key.

x-api-hashstringRequired

Your API Hash.

Body
tygaUserIdstringRequired

Name of the order.

notifyUrlstringRequired

Description of the order.

Responses
200
Order successfully refunded.
application/json
400
Invalid request body.
401
Unauthorized access.
404
Order not found.
500
Internal server error.
post
POST /orders/:orderId/refund HTTP/1.1
Host: 
x-api-key: text
x-api-hash: text
Content-Type: application/json
Accept: */*
Content-Length: 40

{
  "tygaUserId": "text",
  "notifyUrl": "text"
}
{
  "message": "text"
}

Process a cryptocurrency refund for an order.

post
Path parameters
orderIdstringRequired

The unique identifier of the order for which the refund is to be processed.

Header parameters
x-api-keystringRequired

Your unique API Key.

x-api-hashstringRequired

Your API Hash.

Body
addressstringRequired

Crypto address to which the refund will be sent.

networkstringRequired

Blockchain network used for the refund. e.g. 'BSC', 'MATIC', 'TRON'.

tokenstringRequired

Type of cryptocurrency token to be refunded. e.g. 'USDT'.

thirdPartyIdstringOptional

An identifier for the third-party service, if applicable.

otpstringRequired

One-time password for transaction verification.

notifyUrlstringRequired

URL to notify upon the final status of the refund process.

Responses
200
Successfully initiated the refund request.
application/json
400
Invalid request body.
401
Unauthorized access.
404
Order not found.
500
Internal server error.
post
POST /orders/:orderId/refund/crypto HTTP/1.1
Host: 
x-api-key: text
x-api-hash: text
Content-Type: application/json
Accept: */*
Content-Length: 104

{
  "address": "text",
  "network": "text",
  "token": "text",
  "thirdPartyId": "text",
  "otp": "text",
  "notifyUrl": "text"
}
{
  "message": "text"
}
  • Create Order
  • POSTCreate a new order.
  • Order Notify Url (Webhook)
  • Order Completed Notify Url
  • Order Redirect Url
  • Get Order
  • GETRetrieves an order by Id.
  • Cancel Order
  • PUTCancels an order by Id.
  • Refund Order to TygaPay Account
  • POSTRefunds an order by Id.
  • Refund Order to Crypto Address
  • POSTSend a refund OTP to the tenant admin's account.
  • POSTProcess a cryptocurrency refund for an order.
  • Refund NotifyUrl Request (Webhook)

Create a new order.

post
Header parameters
x-api-keystringRequired

Your unique API Key.

x-api-hashstringRequired

Your API Hash.

Body
typestringOptional

Order type e.g. "payment", "deposit".

namestringOptional

Name of the order.

descriptionstringOptional

Description of the order.

orderNumberstringRequired

Unique order number.

amountnumberRequired

Total amount of the order. Amount is optional for 'deposit' orders.

emailstringOptional

Email of the customer making the order.

notifyUrlstringOptional

URL to notify after order is completed.

returnUrlstringOptional

URL to redirect to after order is completed.

Responses
200
Order successfully created.
application/json
400
Invalid request body.
401
Unauthorized access.
500
Internal server error.
post
POST /orders HTTP/1.1
Host: 
x-api-key: text
x-api-hash: text
Content-Type: application/json
Accept: */*
Content-Length: 339

{
  "type": "text",
  "name": "text",
  "description": "text",
  "orderNumber": "text",
  "amount": 1,
  "email": "text",
  "notifyUrl": "text",
  "returnUrl": "text",
  "customerInformation": {
    "firstName": "text",
    "lastName": "text",
    "dob": {
      "year": 1,
      "month": 1,
      "day": 1
    },
    "address": {
      "country": "text",
      "line1": "text",
      "line2": "text",
      "city": "text",
      "state": "text",
      "postalCode": "text"
    }
  }
}
{
  "message": "text",
  "data": {
    "orderId": "text",
    "paymentUrl": "text",
    "paymentDeepLinkUrl": "text",
    "status": "new",
    "alreadyExists": true
  }
}