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

Sign algorithm

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

namerequiredtypesampledescription
mchIdyString(30)10000701assigned by IOTPay
mchOrderNoyString(30)1234567890abcassigned by merchant
customerIdyString(30)604567999assigned by merchant
amountyInt1500in cents
currencyyString(3)CADfor now only CAD supported
jobNoyString(12)jack123merchant's login name
subjectnString(64)
bodynString(250)
notifyUrlyString(200)get notify when success
returnUrlyString(200)redirect to this url after payment
signyString(32)C380BEC2BFD727A4B6845133519F3AD6Sign algorithm

Response

namerequiredtypesampledescription
retCodeyStringSUCCESS or FAIL
retMsgyString
payUrlyStringif retCode=SUCCESS, merchant redirect to this url

NotifyUrl message

namerequiredtypesampledescription
payOrderIdyStringIOTPay transaction number
mchIdyStringmerchant Id
mchOrderNoyStringmerchant transaction number
transIdyStringbank transaction number
currencyyString
amountyInt2000in cents
statusyInt2success: 2 or 3
paySuccTimeyString
cardTypeyStringVpossible value: A/M/I/V/O, blank for unknown type
cardNumyString450116XXXXXX7214
expirationDateyString0725
signyStringSign algorithm

ReturnUrl parameters

namerequiredtypesampledescription
retCodeyStringSUCCESS or FAIL
payOrderIdyStringIOTPay transaction number
mchOrderNoyStringmerchant transaction number
transIdyStringbank transaction number
paySuccTimeyString
statusyInt2success: 2 or 3
signyStringSign 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

sign check

Request URL for adduser

Endpoint: https://api.iotpaycloud.com/v2/cc_adduser

Request method:

  • POST
  • Content-Type: application/json;charset=UTF-8

Parameters

namerequiredtypesampledescription
mchIdyString(30)10000701assigned by IOTPay
customerIdyString(30)604567999assigned by merchant,must be unique
currencyyString(3)CADfor now only CAD supported
jobNoyString(12)jack123merchant's login name
returnUrlyString(200)redirect to this url after payment
signyString(32)C380BEC2BFD727A4B6845133519F3AD6Sign algorithm

each customerId can bind only one credit card, if one user need to bind more cards, use different customerId

Response

namerequiredtypesampledescription
retCodeyStringSUCCESS or FAIL
retMsgyString
payUrlyStringif retCode=SUCCESS, merchant redirect to this url

ReturnUrl parameters

namerequiredtypesampledescription
retCodeyStringSUCCESS or FAIL
customerIdyString00987654321
cardNumberyString450116XXXXXX7214card number
expirationDateyString0725card expire date
cardTypeyStringVV: Visa, M: Mastercard
signyStringSign algorithm

Request URL for purchasewithtoken

Endpoint: https://api.iotpaycloud.com/v2/cc_purchasewithtoken

Request method:

  • POST
  • Content-Type: application/json;charset=UTF-8

Parameters

namerequiredtypesampledescription
mchIdyString(30)10000701assigned by IOTPay
mchOrderNoyString(30)1234567890abcassigned by merchant
customerIdyString(30)604567999assigned by merchant
amountyInt1500in cents
currencyyString(3)CADfor now only CAD supported
jobNoyString(12)jack123merchant's login name
subjectnString(64)
bodynString(250)
signyString(32)C380BEC2BFD727A4B6845133519F3AD6Sign algorithm

Response

namerequiredtypesampledescription
retCodeyStringSUCCESS or FAIL
retMsgyString
ordernJSONif retCode=SUCCESS, order detailed info returned

Basic parameters in order

namerequiredtypesampledescription
payOrderIdyStringSUCCESS or FAILtransaction number assigned by IOTPay
mchOrderNoyStringtransaction number assigned by merchant
transidyStringtransaction number of bank
statusyInttransaction status: 2 or 3 means success
paySuccTimeyStringtransaction success time
originalOrderIdyStringoriginal pay order id if payType=refund
payTypeyStringpay or refundtransaction type

Refund a transaction

Endpoint: https://api.iotpaycloud.com/v2/cc_refund

Request method:

  • POST
  • Content-Type: application/json;charset=UTF-8

Parameters

namerequiredtypesampledescription
mchIdyString(30)10000701assigned by IOTPay
mchRefundNoyString(30)R1234567890abcassigned by merchant
loginNameyString(12)jack_chenassigned by merchant,equals to jobNo
currencyyString(3)CADfor now only CAD supported
refundAmountyInt100in cents
payOrderIdyString(30)100
signyString(32)C380BEC2BFD727A4B6845133519F3AD6Sign algorithm

Response

namerequiredtypesampledescription
retCodeyStringSUCCESS or FAIL
retMsgyString
ordernJSONif 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

namerequiredtypesampledescription
mchIdyString(30)10000701assigned by IOTPay
mchRefundNoyString(30)R1234567890abcassigned by merchant
loginNameyString(12)jack_chenassigned by merchant,equals to jobNo
currencyyString(3)CADfor now only CAD supported
payOrderIdyString(30)100
signyString(32)C380BEC2BFD727A4B6845133519F3AD6Sign algorithm

Response

namerequiredtypesampledescription
retCodeyStringSUCCESS or FAIL
retMsgyString
ordernJSONif 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

namerequiredtypesampledescription
mchIdyString(30)10000701assigned by IOTPay
mchOrderNoyString(30)1234567890abcassigned by merchant
payOrderIdyString(30)1000001
signyString(32)C380BEC2BFD727A4B6845133519F3AD6Sign algorithm

use either payOrderId or mchOrderNo, use one of them

Response

namerequiredtypesampledescription
retCodeyStringSUCCESS or FAIL
retMsgyString
ordernJSONif 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

namerequiredtypesampledescription
mchIdyString(30)10000701assigned by IOTPay
customerIdyString(30)R1234567890abcassigned by merchant
signyString(32)C380BEC2BFD727A4B6845133519F3AD6Sign algorithm

Response

namerequiredtypesampledescription
retCodeyStringSUCCESS or FAILif SUCCESS, merchant can use customerId to call cc_purchasewithtoken
retMsgyString

Demo and source code

Simple purchase: demoopen in new window

Recurring purchase: demoopen in new window

source code downloadopen in new window

Last Updated: