Skip to content

Merchant Open API

Merchants need to log in to the console -> Developer to obtain the Merchant Developer Secret before calling this series of APIs.

Introduction

Request Method

  • HOST: https://open.idatariver.com
  • Headers: Authorization: Bear Your_Developer_Secret

Multi-language Support

The platform supports automatic translation of merchant project/product information into multiple languages. To obtain information in a specific language, simply include the X-Idr-Locale field in the Headers.

The translated content will be stored in the nameI18n and descI18n fields.

Currently, the automatic translation includes the name and desc fields of projects/products.

X-Idr-LocaleLanguage
en🇬🇧 English
fa🇮🇷 Persian
zh-cn🇨🇳 Simplified Chinese
ja🇯🇵 Japanese
ru🇷🇺 Russian
zh-hk🇭🇰 Traditional Chinese
de🇩🇪 German
ar🇦🇪 Arabic
es🇪🇸 Spanish
fr🇫🇷 French
ko🇰🇷 Korean
tr🇹🇷 Turkish
uk🇺🇦 Ukrainian
uz🇺🇿 Uzbek
kk🇰🇿 Kazakh
pl🇵🇱 Polish
pt🇵🇹 Portuguese
pa🇮🇳 Punjabi

Request Example

shell
curl https://open.idatariver.com/mapi?key=value \
  -H "Authorization: Bearer $iDataRiver_Merchant_Secret" \
  -H "X-Idr-Locale: en" \
shell
curl https://open.idatariver.com/mapi \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $iDataRiver_Merchant_Secret" \
  -H "X-Idr-Locale: en" \
  -d '{
    "key": "value"
  }'

Response Format

To ensure uniform management and maintenance of the API, responses follow the field format below:

Field NameDescription
code(Required) Return code, an integer representing the business status. Detailed meanings are provided in the table below.
result(Optional) The complete raw result, with its structure and explanations provided by the supplier.
msg(Optional) Reason for request failure.

Return Code Explanation

The meaning and explanation of the code field:

codeDescription
0Request successful
1000Internal error
1001Parameter error
1002Requested resource not found
1003Internal processing busy, please try again later
1004Insufficient permissions

API Documentation

Use Cases

Open APIs are divided into Public APIs and Private APIs with the following differences:

Public APIs are generally triggered by users, such as placing orders, viewing product information on the merchant's homepage, etc., suitable for use in the frontend of independent sites.

Private APIs should only be used by merchants themselves to access or manage core merchant data, suitable for backend processing of merchant data management.

Even Public APIs should not be directly exposed in the frontend to avoid leaking merchant secrets.

Basic Merchant Store Information Public

Returns basic merchant information.

GET /mapi/merchant/basicInfo

Response Fields
FieldTypeDescription
namestringmerchant name
descstringmerchant introduction
contactsobjectmerchant contact info
websiteobjectwebsite config

Merchant Homepage Information Public

Returns a list of merchant projects along with all product information under each project.

GET /mapi/merchant/info

Response Fields

Example

FieldTypeDescription
namestringmerchant name
descstringmerchant introduction
contactsobjectmerchant contact info
guaranteenumbermerchant guarantee fee
projectsarrayonline projects. please refer to the project api for more details.
websiteobjectwebsite config

Get Order Details Public

Retrieve detailed information of an order by order ID.

GET /mapi/order/info

FieldTypeRequiredDescription
idstringYesOrder ID
Response Fields

Example

FieldTypeDescription
idstringorder id
skuNamestringmerchant name
statusstringorder status, possible values: NEW (new order), DONE (paid), EXPIRED (expired and not paid), REFUND (refunded)
quantitynumberorder quantity
projectNamestringproject name
projectTypestringproject type
merchantstringmerchant id
oriPricenumberoriginal order price
pricenumberorder price.(after deducting the coupon discount)
affCodestringorder affiliates code
anonymousboolreturn true if the order placed anonymously
consumerstringThe consumer's user ID in iDataRiver. It is null when anonymous=true.
contactInfostringThe query information left by the consumer when paying anonymously. Anyone can use this field to query the order
couponstringcoupon code
paymentFeeCoveredboolreturn true if the merchant pay payment gateway fees.
dtstringorder created date
createdAtstringorder created time (UTC+0)
createdTSstringorder created timestamp
digitalItemsStrstringreturn order's digital product content
expiredIntervalnumberorder expired interval
mContactsobjectmerchant contact info
mPaymentsarrayorder payment methods(only display available)
mPayments[*].enabledboolreturn true if payment method enabled
mPayments[*].isPlatformboolreturn true if payment method is iDataRiver provided.
mPayments[*].namestringpayment name
mPayments[*].descstringpayment description
mPayments[*].methodstringPayment method id, iDataRiver's built-in payment channel can take the following values: credits (platform balance payment), crypto (cryptocurrency), alipay (Alipay), wxpay (WeChat Pay), onramp (Visa/MasterCard), onramp-google (Google Pay), onramp-apple (Apple Pay), onramp-revolut(Revolut), onramp-venmo (Venmo), gcash (GCash)
mPayments[*].ratioRangestringPayment channel charges a percentage rate
mPayments[*].fixedFeeRangestringPayment channel charges a fixed fee (USD)
projectobjectProject details, please refer to the project api for more details.
skuobjectProduct details, please refer to the product/sku api for more details.

Create Product Order Public

Place a product order.

POST /mapi/order/add

FieldTypeRequiredDescription
projectIdstringYesProject ID, You can get the id field of the project in the Get All Projects api
skuIdstringYesProduct ID
orderInfoobjectYesOrder details, example: {"quantity": 1,"coupon": "","contactInfo": "","affCode":""}, where quantity is the order quantity, coupon is the discount coupon (if none, pass an empty string), contactInfo is the contact information (required), used for retrieving the order, with string length of 5-100, and affCode is the affiliate promotion code (optional).

For the BUYMEABTC project, the skuId field is not required. The orderInfo field format is as follows:

{"amount":5, "private": false, "name": "", "message": ""}

  • amount Sponsorship amount, in USD
  • private Whether to make the sponsorship information public
  • name Nickname, can be empty
  • message Message, can be empty
Response Fields
FieldTypeDescription
orderIdstringorder id

Pay for Product Order Public

Get the order payment redirection link.

If the order price is 0, the purchase will be successful directly and no payment link will be returned.

POST /mapi/order/pay

FieldTypeRequiredDescription
idstringYesOrder ID
methodstringYesPayment method, from the method value in the mPayments field of the order details interface
redirectUrlstringNoRedirection link after successful payment, should point to the order page and include the complete domain name
callbackUrlstringNoBackend callback notification triggered when the order completed or refunded, the order data will be sent to this link via a POST request (in JSON format), please process it within 5 seconds and return a 200/201 status code, otherwise it will be considered a callback failure. If the callback fails, it will be retried up to 5 times. This URL must use a domain name (https) and cannot be accessed through IP

callback check

For the order fields returned by callbackUrl, please refer to the order details API.

You can check whether the order is PAID or REFUND by the status field of the callback order.

When receiving an order callback, please request the order information API to confirm the real status of the order.

This can prevent malicious callbacks from third parties when the merchant's callbackUrl is leaked.

Note: The callback priority here is higher than the Event Webhook set by the merchant.

Response Fields
FieldTypeDescription
payUrlstringpayment url
payCurrencystringpayment currency
amountnumberpayment amount

Query Product Order List Public

Query the order list based on the contact information or order ID left when creating the order.

GET /mapi/order/search

FieldTypeRequiredDescription
querystringYesContact information or order number left when placing the order
Response Fields
FieldTypeDescription
itemsarrayorder list
items[*].idstringorder id
items[*].pricestringorder price
items[*].quantitystringorder quantity
items[*].skuNamestringproduct name
items[*].statusstringorder status
items[*].datestringorder created date (UTC+0)

Get Merchant Order List Private

Retrieve the merchant's order list in reverse chronological order.

GET /mapi/order/list

FieldTypeRequiredDescription
statusstringNoOrder status, default is empty indicating no status filtering, possible values: DONE (completed), NEW (new order), EXPIRED (expired), REFUND (refunded)
pagestringNoPagination parameter, default is 1, increment by 1 for each page

Get All Projects Private

Returns all projects created by the merchant, including projects that are not yet online.

Response Fields
FieldTypeDescription
hasMoreboolreturn true if has more
itemsarrayorder list
items[*].idstringorder id
items[*].pricestringorder price
items[*].quantitystringorder quantity
items[*].skuNamestringproduct name
items[*].statusstringorder status
items[*].payMethodstringconsumer paid method
items[*].payTostringplatform means pay to iDataRiver, merchant means pay to merchant directly.
items[*].platformFeenumberplatform fee
items[*].paymentFeenumberpayment gateway fee
items[*].paymentFeeCoveredboolreturn true if the merchant pay payment gateway fees.
items[*].profitnumberThe net profit after deducting all fees
items[*].datestringorder created date (UTC+0)

GET /mapi/project/list

Get Specific Project Private

Retrieve all data contained in a project, including product list, pricing list, and coupon list.

Digital products will return all inventory data.

Response Fields

Example

FieldTypeDescription
projectsarray项目列表
projects[*].idstringprojectid
projects[*].typestringproject type
projects[*].statusstringproject status
projects[*].coverstringimage link or base64 data
projects[*].namestringproject name
projects[*].nameI18nobjectproject name(global languages)
projects[*].descstringproject description
projects[*].descI18nobjectproject description (global languages)
projects[*].i18nTypenumber0 means auto translate、1 mean disabled
projects[*].ownerstringmerchant id
projects[*].seoPathstringproject url path
projects[*].slugstringproject short id
projects[*].createdTSstringproject created timestamp
projects[*].createdAtstringproject created time
projects[*].updatedAtstringproject updated time

GET /mapi/project/detail

FieldTypeRequiredDescription
idstringYesProject ID
Response Fields

Example

FieldTypeDescription
idstringproject id
typestringproject type
statusstringproject status
coverstringimage link or base64 data
namestringproject name
nameI18nobjectproject name(global languages)
descstringproject description
descI18nobjectproject description (global languages)
i18nTypenumber0 means auto translate、1 mean disabled
ownerstringmerchant id
seoPathstringproject url path
slugstringproject short id
createdTSstringproject created timestamp
createdAtstringproject created time
updatedAtstringproject updated time
affiliatesarrayaffiliates
affiliates[*].idstringid
affiliates[*].userIdstringaff's merchant id
affiliates[*].codestringaff code
affiliates[*].namestringaff name
affiliates[*].rationumbercommission ratio
affiliates[*].totalAmountnumberaff's total sales
affiliates[*].settledAmountnumbersettled amount
affiliates[*].settledProfitnumbersettled profit
affiliates[*].lastSettleAtstringlast settlement time
affiliates[*].lastSettleTSstringast settlement timestamp
couponsarraycoupons
coupons[*].idstringid
coupons[*].statusstringcoupon status
coupons[*].codestringcoupon code
coupons[*].scopestringpossible values: globle (valid to all products), specific (valid to specific products)
coupons[*].policystringDiscount strategy, possible values: reduction (price reduction), fixed (fixed price), discount (discount coupon)
coupons[*].fixednumberthe fixed price when policy=fixed
coupons[*].discountnumberthe discount rate when policy=discount
coupons[*].cappednumberthe reduction amount when policy=reduction
coupons[*].usedNumnumberused times
coupons[*].scopeItemsarraythe product/sku id list when scope=specific
pricingsarraypricing list
pricings[*].idstringid
pricings[*].statusstringpricing status
pricings[*].scopestringpossible values: globle (valid to all products), specific (valid to specific products)
pricings[*].policystringThe possible values: fixed (fixed price), stage_quantity (tiered discount based on purchase quantity), stage_rpd (API business use, tiered discount based on the number of daily api calls), dynamic (API business use, dynamic pricing for each call)
pricings[*].pricenumberprice when policy=fixed
pricings[*].stagesarraytiered pricing rules
pricings[*].dynamicCappednumberThe maximum amount allowed when policy=dynamic, the default is no more than 0.2USD
pricings[*].scopeItemsarraythe product/sku id list when scope=specific
skusarrayproduct/sku list
skus[*].idstringproduct/sku id
skus[*].statusstringproduct status
skus[*].prioritynumberProduct display priority, the smaller the value, the higher the priority
skus[*].soldnumbersold number
skus[*].pricingScopestringThe possible values: global or specific, indicating whether the price is global or specific.
skus[*].docLinkstringexternal docs link
skus[*].stocknumberstock
skus[*].namestringproduct name
skus[*].nameI18nobjectproduct name(global languages)
skus[*].descstringproduct description
skus[*].descI18nobjectproduct description(global languages)
skus[*].hiddenStockboolwhether to hide stock
skus[*].itemTypestringWhen type=DIGITAL, the possible values: reuse (repeated sale), consumable (delete after sale)
skus[*].itemsarrayWhen type=DIGITAL, return all data items
skus[*].itemsNumstringWhen type=DIGITAL, return the number of items

Create New Project Private

Create a new project.

POST /mapi/project/add

FieldTypeRequiredDescription
namestringYesProject name
typestringYesProject type, currently supports digital products: DIGITAL
Response Fields
FieldTypeDescription
idstringproject id

Update Project Information Private

Update basic project information.

POST /mapi/project/update

FieldTypeRequiredDescription
idstringYesProject ID, can be obtained from the project list interface
namestringYesProject name, no more than 50 characters
statusstringYesProject status, possible values: ONLINE, OFFLINE
i18nTypestringNoAutomatic translation status, possible values: enable-0, disable-1, default is 1
descstringNoProject description, no more than 500 characters
coverstringNoImage base64 encoding, no more than 2Mb, only supports PNG, JPG, JPEG formats, example: data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAkACQAAD...

Delete Project (Irreversible) Private

Delete a project.

POST /mapi/project/remove

FieldTypeRequiredDescription
projectstringYesProject ID

Get Single Product/SKU Details Private

Retrieve detailed information of a specific product under a project. Digital products will return data items.

GET /mapi/project/sku/detail

FieldTypeRequiredDescription
idstringYesProduct/SKU ID
Response Fields

Example

FieldTypeDescription
idstringproduct/sku id
statusstringproject status
namestringproject name
nameI18nobjectproject name(global languages)
descstringproject description
descI18nobjectproject description (global languages)
ownerstringmerchant id
projectstringproject id
prioritynumberProduct display priority, the smaller the value, the higher the priority
soldnumbersold number
docLinkstringexternal docs link
stocknumberstock
hiddenStockboolwhether to hide stock
itemTypestringWhen type=DIGITAL, the possible values: reuse (repeated sale), consumable (delete after sale)
itemsarrayWhen type=DIGITAL, return all data items
itemsNumstringWhen type=DIGITAL, return the number of items
orderobjectorder info
createdTSstringproject created timestamp
createdAtstringproject created time
updatedAtstringproject updated time

Add Project Product/SKU Private

Add a product under a specified project.

POST /mapi/project/sku/add

FieldTypeRequiredDescription
projectIdstringYesProject ID
Response Fields
FieldTypeDescription
idstringproduct/sku id

Update Product/SKU Private

Update product information.

When modifying digital product inventory data, the new data will directly overwrite the original inventory data items.

Therefore, if you need to change the inventory data items of digital products, please take the product offline first to avoid conflicts with ongoing orders.

POST /mapi/project/sku/update

FieldTypeRequiredDescription
idstringYesProduct/SKU ID
namestringNoProduct name, no more than 50 characters
statusstringNoProduct status, possible values: ONLINE, OFFLINE
prioritynumberNoProduct priority, range is 1-100
itemTypestringNoData item type, possible values: reusable-reuse, consumable-consumable
itemsarrayNoDigital product data items, each element corresponds to a card code, example: ["123", "456"], must pass the itemType parameter simultaneously. 🔔 This value will directly overwrite the original card codes, please use cautiously
docLinkstringNoExternal document link
hiddenStockboolNoWhether to hide inventory, values true or false
descstringNoProject description, no more than 500 characters

When updating a product, at least one valid field needs to be updated, otherwise it will return a failure.

Delete Product/SKU Private

Permanently delete a product, cannot be undone.

POST /mapi/project/sku/remove

FieldTypeRequiredDescription
idstringYesProduct/SKU ID

Add Pricing Plan Private

Add a pricing plan.

POST /mapi/project/pricing/add

FieldTypeRequiredDescription
projectIdstringYesProject ID
Response Fields
FieldTypeDescription
idstringpricing id

Update Pricing Plan Private

Update a pricing plan.

POST /mapi/project/pricing/update

FieldTypeRequiredDescription
idstringYesPricing plan ID
statusstringYesProduct status, possible values: ONLINE, OFFLINE
scopestringYesProduct status, possible values: global-global, specific range-specific
scopeItemsarrayNoWhen scope=specific, this array contains the IDs of the products to be affected and cannot be empty
policystringYesPricing strategy, possible values: fixed price-fixed, wholesale price-stage_quantity
pricestringNoFixed price, required when policy=fixed
stagesobjectNoWholesale price settings, required when policy=stage_quantity, example: [{ "threshold": 0, 'price': 10 },{ "threshold": 10, 'price': 8 }] means the unit price is 10 USD for purchases less than 10 units, and 8 USD for purchases of 10 units or more, with a maximum of 5 stages

Delete Pricing Plan Private

Permanently delete a pricing plan, cannot be undone.

Please ensure that there is at least one available pricing plan for the product.

POST /mapi/project/pricing/remove

FieldTypeRequiredDescription
idstringYesPricing plan ID

Add Coupon Private

Add a coupon.

POST /mapi/project/coupon/add

FieldTypeRequiredDescription
projectIdstringYesProject ID
Response Fields
FieldTypeDescription
idstringcoupon id

Update Coupon Private

Update coupon rules.

POST /mapi/project/coupon/update

FieldTypeRequiredDescription
idstringYesCoupon ID
statusstringYesProduct status, possible values: ONLINE, OFFLINE
scopestringYesProduct status, possible values: global-global, specific range-specific
scopeItemsarrayNoWhen scope=specific, this array contains the IDs of the products to be affected and cannot be empty
policystringYesPricing strategy, possible values: reduction coupon-reduction, discount coupon-discount, fixed price coupon-fixed
reductionnumberNoReduction amount for reduction coupons, required when policy=reduction
fixednumberNoFixed price amount for fixed price coupons, required when policy=fixed
discountnumberNoDiscount percentage, range 1-100, required when policy=discount
cappednumberNoDiscount cap amount, used to control the maximum discount amount when policy=discount

Delete Coupon Private

Permanently delete a coupon, cannot be undone.

POST /mapi/project/coupon/remove

FieldTypeRequiredDescription
idstringYesCoupon ID

Telegram Bot Bulk Messaging Private

This feature requires merchants to first enable a custom Telegram bot. Merchants can also use the Telegram Bulk Messaging Assistant directly in the store.

Add a Telegram broadcast message to be sent using the merchant's custom Telegram bot.

🔔 This interface does not limit the number of bulk messages, but only one bulk message can be processed at a time. You must wait for the previous bulk message to be processed before sending another.

It is strongly recommended to use this feature wisely. Each bulk message will automatically filter out invalid users.

POST /mapi/rainbow/broadcast/add

FieldTypeRequiredDescription
contentstringYesBulk message content, no more than 4000 characters
testboolYesWhether it is test mode, pass true to send only to the account bound by the merchant (commonly used for testing before official bulk messaging), pass false to send to all users who can receive messages

Get Telegram Bot Bulk Messaging History Private

Retrieve recent Telegram bot bulk messaging history, including total number of users, number of users who declined, number of successful sent, and total execution time.

GET /mapi/rainbow/broadcast/list

Response Fields

Example

FieldTypeDescription
itemsarraybroadcast list
items[*].idstringbraodcast id
items[*].eidstringbusiness id (for deduplication)
items[*].statusstringstatus
items[*].paramsobjectbroadcast params
items[*].createdTSstringcreated timestamp
items[*].createdAtstringcreated time

Query License Info Public

Query License details.

GET /mapi/license/query

FieldTypeRequiredDescription
codestringYesLicense code, supports pass multiple values (comma-separated), up to 100 at a time
Response Fields
FieldTypeDescription
itemsarraylicense list
items[*].licensestringlicense code
items[*].statusstringlicense status
items[*].statesstringbusiness states
items[*].orderstringorder id
items[*].merchantstringmerchant id
items[*].skuNamestringproduct name
items[*].createdTSstringcreated timestamp
items[*].createdAtstringcreated time
items[*].activateTSstringactivate timestamp
items[*].activateAtstringactivate time

Activate License Private

Mark the License as used, this process is irreversible.

License can only be activated once, and the merchant should call this API to activate the License after it is used to prevent it from being reused.

POST /mapi/license/activate

FieldTypeRequiredDescription
codestringYesLicense code, supports pass multiple values (comma-separated), up to 100 at a time

The response data will include the successfully activated License information.

Response Fields
FieldTypeDescription
itemsarraylicense list
items[*].licensestringlicense code
items[*].statusstringlicense status
items[*].statesstringbusiness states
items[*].orderstringorder id
items[*].merchantstringmerchant id
items[*].skuNamestringproduct name
items[*].createdTSstringcreated timestamp
items[*].createdAtstringcreated time
items[*].activateTSstringactivate timestamp
items[*].activateAtstringactivate time

Make things simple and timeproof.