Credit Card API V2(Deprecated)
Only CAD transaction supported.
There are two modes for credit card integration:
Simple Purchase
Recurring Purchase
Sign generate and check
Request and response format
All request and response are JSON format
Sending request demo code
$arr = array(
    'customerId' => '0000000123',
    'mchOrderNo' => 'm12345',
    'mchId' => 'your merchant id',
  	'currency' => 'CAD',
    'amount' => 100,   // in cents
    'jobNo' => 'jack', //your login name
    'notifyUrl' => 'http://yourdomain.com/notifyme.php',
    'returnUrl' => 'http://yourdomain.com/returnhere.php',
    'subject' => "ipad pro",
    'body' => '64G,wifi,white'
);
$Utility = new Utility();
$sort_array = $Utility->arg_sort($arr);   //sort the parameters
$arr['sign'] = $Utility->build_mysign($sort_array, $merchantKey, "MD5");   //generate sign and put it into the array
$param = json_encode($arr);    //generate json string to send
$resBody = $Utility->request($url, $param);//Submit to the gateway
$res = json_decode($resBody, true);
if ($res['retCode'] == 'SUCCESS') {
    header('Location: ' . $res['payUrl']);//Redirect to payment page
} else {
    echo $res['msg'];
}Simple purchase
User input card info and purchase once, users will be prompted to input card info each time when they purchase.
Sequence
1, Call cc_purchase and redirect to payUrl to let user input credit card info; 
 2, After purchase, will redirect to returnUrl; 
 3, If the transaction is successful, IOTPay will notify to notifyUrl;
Request URL for simple purchase
Endpoint: https://api.iotpaycloud.com/v2/cc_purchase
Request method:
- POST
 - Content-Type: application/json;charset=UTF-8
 
Parameters
| name | required | type | sample | description | 
|---|---|---|---|---|
| mchId | y | String(30) | 10000701 | assigned by IOTPay | 
| mchOrderNo | y | String(30) | 1234567890abc | assigned by merchant | 
| customerId | y | String(30) | 604567999 | assigned by merchant | 
| amount | y | Int | 1500 | in cents | 
| currency | y | String(3) | CAD | for now only CAD supported | 
| jobNo | y | String(12) | jack123 | merchant's login name | 
| subject | n | String(64) | ||
| body | n | String(250) | ||
| notifyUrl | y | String(200) | get notify when success | |
| returnUrl | y | String(200) | redirect to this url after payment | |
| sign | y | String(32) | C380BEC2BFD727A4B6845133519F3AD6 | Sign algorithm | 
Response
| name | required | type | sample | description | 
|---|---|---|---|---|
| retCode | y | String | SUCCESS or FAIL | |
| retMsg | y | String | ||
| payUrl | y | String | if retCode=SUCCESS, merchant redirect to this url | 
NotifyUrl message
| name | required | type | sample | description | 
|---|---|---|---|---|
| payOrderId | y | String | IOTPay transaction number | |
| mchId | y | String | merchant Id | |
| mchOrderNo | y | String | merchant transaction number | |
| transId | y | String | bank transaction number | |
| currency | y | String | ||
| amount | y | Int | 2000 | in cents | 
| status | y | Int | 2 | success: 2 or 3 | 
| paySuccTime | y | String | ||
| cardType | y | String | V | possible value: A/M/I/V/O, blank for unknown type | 
| cardNum | y | String | 450116XXXXXX7214 | |
| expirationDate | y | String | 0725 | |
| sign | y | String | Sign algorithm | 
ReturnUrl parameters
| name | required | type | sample | description | 
|---|---|---|---|---|
| retCode | y | String | SUCCESS or FAIL | |
| payOrderId | y | String | IOTPay transaction number | |
| mchOrderNo | y | String | merchant transaction number | |
| transId | y | String | bank transaction number | |
| paySuccTime | y | String | ||
| status | y | Int | 2 | success: 2 or 3 | 
| sign | y | String | Sign algorithm | 
Recurring purchase
User input card info once, can purchase with the tokenized card multiple times.
Sequence
1, Call cc_adduser and then redirect to payUrl to let user input credit card info; 
 2, After adduser, will redirect to returnUrl with the following parameters: 
 If success: retCode=SUCCESS&customerId=xxx&cardNumber=450116XXXXXX7214&expirationDate=0725&cardType=V&sign=xxxx 
 If fail: retCode=FAIL&customerId=xxxx&sign=xxxx
 3, If adduser is successful, call cc_purchasewithtoken to do real purchase
Request URL for adduser
Endpoint: https://api.iotpaycloud.com/v2/cc_adduser
Request method:
- POST
 - Content-Type: application/json;charset=UTF-8
 
Parameters
| name | required | type | sample | description | 
|---|---|---|---|---|
| mchId | y | String(30) | 10000701 | assigned by IOTPay | 
| customerId | y | String(30) | 604567999 | assigned by merchant,must be unique | 
| currency | y | String(3) | CAD | for now only CAD supported | 
| jobNo | y | String(12) | jack123 | merchant's login name | 
| returnUrl | y | String(200) | redirect to this url after payment | |
| sign | y | String(32) | C380BEC2BFD727A4B6845133519F3AD6 | Sign algorithm | 
each customerId can bind only one credit card, if one user need to bind more cards, use different customerId
Response
| name | required | type | sample | description | 
|---|---|---|---|---|
| retCode | y | String | SUCCESS or FAIL | |
| retMsg | y | String | ||
| payUrl | y | String | if retCode=SUCCESS, merchant redirect to this url | 
ReturnUrl parameters
| name | required | type | sample | description | 
|---|---|---|---|---|
| retCode | y | String | SUCCESS or FAIL | |
| customerId | y | String | 00987654321 | |
| cardNumber | y | String | 450116XXXXXX7214 | card number | 
| expirationDate | y | String | 0725 | card expire date | 
| cardType | y | String | V | V: Visa, M: Mastercard | 
| sign | y | String | Sign algorithm | 
Request URL for purchasewithtoken
Endpoint: https://api.iotpaycloud.com/v2/cc_purchasewithtoken
Request method:
- POST
 - Content-Type: application/json;charset=UTF-8
 
Parameters
| name | required | type | sample | description | 
|---|---|---|---|---|
| mchId | y | String(30) | 10000701 | assigned by IOTPay | 
| mchOrderNo | y | String(30) | 1234567890abc | assigned by merchant | 
| customerId | y | String(30) | 604567999 | assigned by merchant | 
| amount | y | Int | 1500 | in cents | 
| currency | y | String(3) | CAD | for now only CAD supported | 
| jobNo | y | String(12) | jack123 | merchant's login name | 
| subject | n | String(64) | ||
| body | n | String(250) | ||
| sign | y | String(32) | C380BEC2BFD727A4B6845133519F3AD6 | Sign algorithm | 
Response
| name | required | type | sample | description | 
|---|---|---|---|---|
| retCode | y | String | SUCCESS or FAIL | |
| retMsg | y | String | ||
| order | n | JSON | if retCode=SUCCESS, order detailed info returned | 
Basic parameters in order
| name | required | type | sample | description | 
|---|---|---|---|---|
| payOrderId | y | String | SUCCESS or FAIL | transaction number assigned by IOTPay | 
| mchOrderNo | y | String | transaction number assigned by merchant | |
| transid | y | String | transaction number of bank | |
| status | y | Int | transaction status: 2 or 3 means success | |
| paySuccTime | y | String | transaction success time | |
| originalOrderId | y | String | original pay order id if payType=refund | |
| payType | y | String | pay or refund | transaction type | 
Refund a transaction
Endpoint: https://api.iotpaycloud.com/v2/cc_refund
Request method:
- POST
 - Content-Type: application/json;charset=UTF-8
 
Parameters
| name | required | type | sample | description | 
|---|---|---|---|---|
| mchId | y | String(30) | 10000701 | assigned by IOTPay | 
| mchRefundNo | y | String(30) | R1234567890abc | assigned by merchant | 
| loginName | y | String(12) | jack_chen | assigned by merchant,equals to jobNo | 
| currency | y | String(3) | CAD | for now only CAD supported | 
| refundAmount | y | Int | 100 | in cents | 
| payOrderId | y | String(30) | 100 | |
| sign | y | String(32) | C380BEC2BFD727A4B6845133519F3AD6 | Sign algorithm | 
Response
| name | required | type | sample | description | 
|---|---|---|---|---|
| retCode | y | String | SUCCESS or FAIL | |
| retMsg | y | String | ||
| order | n | JSON | if retCode=SUCCESS, order detailed info returned | 
Void a transaction
Endpoint: https://api.iotpaycloud.com/v2/cc_void
Request method:
- POST
 - Content-Type: application/json;charset=UTF-8
 
Parameters
| name | required | type | sample | description | 
|---|---|---|---|---|
| mchId | y | String(30) | 10000701 | assigned by IOTPay | 
| mchRefundNo | y | String(30) | R1234567890abc | assigned by merchant | 
| loginName | y | String(12) | jack_chen | assigned by merchant,equals to jobNo | 
| currency | y | String(3) | CAD | for now only CAD supported | 
| payOrderId | y | String(30) | 100 | |
| sign | y | String(32) | C380BEC2BFD727A4B6845133519F3AD6 | Sign algorithm | 
Response
| name | required | type | sample | description | 
|---|---|---|---|---|
| retCode | y | String | SUCCESS or FAIL | |
| retMsg | y | String | ||
| order | n | JSON | if retCode=SUCCESS, order detailed info returned | 
Query order
Endpoint: https://api.iotpaycloud.com/v2/cc_query
Request method:
- POST
 - Content-Type: application/json;charset=UTF-8
 
Parameters
| name | required | type | sample | description | 
|---|---|---|---|---|
| mchId | y | String(30) | 10000701 | assigned by IOTPay | 
| mchOrderNo | y | String(30) | 1234567890abc | assigned by merchant | 
| payOrderId | y | String(30) | 1000001 | |
| sign | y | String(32) | C380BEC2BFD727A4B6845133519F3AD6 | Sign algorithm | 
use either payOrderId or mchOrderNo, use one of them
Response
| name | required | type | sample | description | 
|---|---|---|---|---|
| retCode | y | String | SUCCESS or FAIL | |
| retMsg | y | String | ||
| order | n | JSON | if retCode=SUCCESS, order detailed info returned | 
Query user binding status
Endpoint: https://api.iotpaycloud.com/v2/cc_isbinding
Request method:
- POST
 - Content-Type: application/json;charset=UTF-8
 
Parameters
| name | required | type | sample | description | 
|---|---|---|---|---|
| mchId | y | String(30) | 10000701 | assigned by IOTPay | 
| customerId | y | String(30) | R1234567890abc | assigned by merchant | 
| sign | y | String(32) | C380BEC2BFD727A4B6845133519F3AD6 | Sign algorithm | 
Response
| name | required | type | sample | description | 
|---|---|---|---|---|
| retCode | y | String | SUCCESS or FAIL | if SUCCESS, merchant can use customerId to call cc_purchasewithtoken | 
| retMsg | y | String | 
Demo and source code
Simple purchase: demo
Recurring purchase: demo
source code download
