中文简体    English


IVYIOT Cloud Service Payment Access API


Version history:

Revision date Version number Modified by Desc
2019-05-10 V1.0 Chen Hanzhen Create first draft
2019-08-22 V1.1 Xu Kai H5 page entry parameter increase
2019-09-09 V1.2 Xu Kai 1. Add 3.1 / 3.2 OS parameter; 2. Add 3.3 / 3.4 IOS and Android access description
2019-12-14 V1.3 Yang Zhaoyan Documents published online
2019-12-14 V1.4 Meng JiuHua Documents published online

1. Brief description

In order to simplify the connection of order and payment related interfaces, our company provides H5 page related to order and payment. App can enter the order and payment page by passing in corresponding parameters as required. After the purchase service process is completed, the purchased service needs to be authorized and activated.

2. Business process

2.1 Payment and purchase process

payment and purchase process:

When the user fails to activate the device after successful payment, the app compensates the activation process:

2.2 Process description

  • Step 1:
    The user clicks purchase cloud service in the app and jumps to the device selection page, which needs to be designed by the app manufacturer and used for the user to select the device to purchase cloud service;
  • Step 2:
    After the user selects the device, fill in the H5 entry url parameter, and then open this Url in the App;
  • Step 3:
    After entering the H5 page, the app needs to monitor the jump path in H5. When the path contains fospayclose or activatedevice, the H5 page needs to be closed;
  • Step 4:
    When the H5 page is closed, the app needs to call the interface to check whether the user has an inactive service. When there is no inactive service, the process ends;
  • Step 5:
    When the user has an inactive service, he needs to call the interface to query the cloud service information written to the device, and then write it to the device. If the write to the device fails, repeat this step until the write to the device succeeds;
  • Step 6:
    After the cloud service information is successfully written to the device, the activation service interface is called to complete the activation service process, and the device end can use the authorization service after completion;

3. H5 page entry and parameter description

3.1 Overseas payment (overseas users)

Entrance address:
https://{host}/mobile/store_product?clientId=&openId=&accessToken=&ipcName=&ipcMac=&language=&country=&oemCode=

Parameter name Parameter description
clientId Manufacturer clientId
openId user openId
accessToken user accessToken
ipcName device name
ipcMac MAC address of the device (please exclude the English colon in the address)
Language ‘CHS’ - Chinese,’ ENU ‘- English,’ FRA ‘- French,’ GER ‘- German,’ ITL ‘- Italian,’ ESP ‘- Spanish;
Country Country selected for user registration
oemCode Manufacturer of user oemCode
hideTit Hide title block, optional, not hidden by default, hide title block when the value is 1
os System type [IOS, Android, WAP] IOS: IOS mobile app, Android: Android mobile app, WAP: WAP website app

Note: {host} is configured as follows:

  • The test environment :sandboxt-web.ivyiot.io
  • Online environment : www.myfoscam.com

Payment method:

  • WorldPay payment (bank card) and paypal payment
  • The PayPal test payment account is[ foscam@qq.com ] mailto:389506244- > foscam@qq.com"">389506244-foscam@qq.com (non cloud account), password 12345678;

3.2 Domestic payment (Domestic users)

Entrance address:https://{host}/mobile/store_product_cn?
clientId=&openId=&accessToken=&ipcName=&ipcMac=&language=&oemCode=

Parameter name Parameter description
clientId Manufacturer clientId
openId user openId
accessToken user accessToken
ipcName device name
ipcMac MAC address of the device (please exclude the English colon in the address)
Language ‘CHS’ - Chinese,’ ENU ‘- English,’ FRA ‘- French,’ GER ‘- German,’ ITL ‘- Italian,’ ESP ‘- Spanish;
oemCode Manufacturer of user oemCode
hideTit Hide title block, optional, not hidden by default, hide title block when the value is 1
os System type [IOS, Android, WAP] IOS: IOS mobile app, Android: Android mobile app, WAP: WAP website app

Note: {host} is configured as follows:

3.3 IOS access description

3.3.1 Use UIWebView to load H5 page

According to the users at home and abroad, load the corresponding payment page respectively. For the specific URL, please refer to the 3.H5 page entry and parameter description, load the request through UIWebView , and set the proxy.

3.3.2 Processing server return in UIWebView agent

Process the following requests in[UIWebViewDelegate webView:shouldStartLoadWithRequest:navigationType:]:
“fosPlayClose”: Payment complete, exit the current page;
“wx.tenpay.com”: If this field is detected, you need to check whether the wechat application is installed on the mobile phone through [[UIApplication sharedApplication] canOpenURL:[NSURL URLString:@”weixin://“]]. Prompt the user to install wechat before installation;
“BuildID.foscam.cn”: Indicates that you have jumped to wechat to start payment, and“ BuildID.foscam.cn “Replace with” https://“to form a new link and reload the new link.

3.3.3 Other configurations

Configure URL types in TARGETS, fill in BuildID of current app in identifier, and fill in URL Schemes BuildID.foscam.cn ;

3.4 Android access instructions

3.4.1 Use WebView to load H5 page

According to the users at home and abroad, load the corresponding payment page respectively. For the specific URL, please refer to the 3.h5 page entry and parameter description, load the request through WebView, and set the proxy.

3.4.2 Processing server return in WebView agent

Process the following request in the shouldOverrideUrlLoading method:
“fosPlayClose”:Exit the current page;
“weixin://wap/pay?”: This field is detected to jump to wechat. Before jump, you need to determine whether wechat application has been installed by obtaining package information of all installed programs. Prompt the user to install wechat before installation;
“activateDevice”: Indicates that the payment is completed and then the device is activated to exit the current interface.

3.4.3 Other configurations

Configure the Referer in shouldOverrideUrlLoading:
Map<String, String> extraHeaders = new HashMap<>();
extraHeaders.put(“Referer”, BuildConfig.URL_CN_PAY_REALM_ANME);
view.loadUrl(url, extraHeaders);

4. Activate service related interfaces

4.1 Access to services not activated by users

Interface Description:

  • Query all inactive authorization records of users

Request URL:

  • https://{HOST}/gateway?service=permission.query_user_not_active

Request method:

  • GET

Request header:

Request parameters:

Parameter name Data type Is it necessary Description Length
clientId String Mandatory appKey 40
openId String Mandatory openId(user identity) 40
accessToken String Mandatory accessToken 40
supportBpi int Mandatory BPI supported: 0 not supported by 1 1

Return to example:

{
    "errorCode":"",
    "data":[
        {
            "grantId":222222,
            "ipcMac":"ipcMac",
            "permissionCode":"permissionCode",
            "permissionName":"permissionName",
            "permissionType":1,
            "permissionValue":0,
            "grantStatus":1,
            "userTag":"userTag",
            "streamId":"streamId",
            "belongServer":"belongServer",
            "initTime":1565847960000,
            "channelCount":0
        },
        {
            "grantId":111111,
            "ipcMac":"ipcMac",
            "permissionCode":"permissionCode",
            "permissionName":"permissionName",
            "permissionType":1,
            "permissionValue":0,
            "grantStatus":1,
            "userTag":"userTag",
            "belongServer":"belongServer",
            "initTime":1565847960000,
            "channelCount":0
        }
    ],
    "sysDate":1576289329443
}

Return parameter description:

Parameter name Description
errorCode Error code, null if successful
failureDetails Reason for failure
data Return JSON object
data.grantId Authorization record ID
data.ipcMac Device mac
data.permissionCode Permission code
data.permissionName Permission name
data.permissionType 1. Service authorization type, 1 payment, 2 give, 3 free
data.permissionValue No processing required
data.grantStatus Authority status, 1. Authority status, which is payment completed and waiting for service activation, the service needs to activate the device first;. 3. Authorization succeeded
data.usreTag Tag of user corresponding service
data.streamId Cloud storage stream ID
data.belongServer Basic service code
data.initTime Service purchase time
sysDate System time, seconds from 1970 to now

Error code description:

Basic return code Description
FC_SERVICE_NOT_IMPLEMENT(009999) The API does not exist or is not implemented
FC_INVALID_PARAMETER(000006) Request parameter error
FC_SYSTEM_ERROR(000099) System error

4.2 Cloud platform activation permission

Interface Description:

  • Activate device individual permissions

Request URL:

  • https://{HOST}/gateway?service=permission.active

Request method:

  • POST

Request header:

Name Is it necessary Type Description
Content-Type true string Request type: application/x-www-form-urlencoded

Request parameters:

Parameter name Data type Is it necessary Description Length
clientId String Mandatory appKey 40
openId String Mandatory openId(user identity) 40
accessToken String Mandatory accessToken 40
grantId long Mandatory The authorization record number is obtained by querying the interface of inactive authorization record of order 20
ipcMac String Mandatory Device MAC address 20
exceptionInfo String Optional Exception information 1024
appClientVersion String Optional App version information 50

Return to example:

{
    "errorCode":"",
    "failureDetails":""
}

Return parameter description:

Parameter name Description
errorCode Error code, null if successful
failureDetails Reason for failure

Error code description:

Basic return code Description
FC_SERVICE_NOT_IMPLEMENT(009999) The API does not exist or is not implemented
FC_INVALID_PARAMETER(000006) Request parameter error
FC_SYSTEM_ERROR(000099) System error
Business return code Description
PERMISSION_GRANTID_RECORD_NOT_EXISTS(883202) Authorization record does not exist
PERMISSION_GRANTID_RECORD_NOT_MATCH_IPCMAC(883204) Authorization record does not match IPC
PERMISSION_GRANT_STATUS_CANNOT_ACTIVE(883203) The authorization record status is incorrect and activation is not allowed
文档更新时间: 2020-06-30 20:09   作者:admin