API?α??ѴĶ??????ͤ??͡??Ǥ????ؿ?Ū?ʥ????פǰ??????ݥ??Ȥǥꥯ?????Ȥ??륿???פ⤢???С??إå?????????ɬ?פ????????ѥ???????????åȤ???GET?ǥꥯ?????Ȥ??????̥??åȤ?JSON??Array???????ˡ?Struct?ʹ?¤?Ρˡ??????ꡢ?Х??ʥ??????Ǽ????????ʤɤΥ????????ͤ??????ޤ???
Coldfusion?Ǥ?¿?ͤʳ???API?δĶ????????˹??碌???ꥯ?????ȴؿ??κ???????ǽ?Ǥ??????????Ǥϡ?curl?ꥯ?????Ȥ˴??Ť??ơ?cfhttp?????Ѥ????ؿ??Υ????ץ??????????Ƥߤޤ???
curl?ꥯ??????
curl https://url/paymentMethods \
-H "x-API-key: YOUR_X-API-KEY" \
-H "content-type: application/json" \
-d '{
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"countryCode": "NL",
"amount": {
"currency": "EUR",
"value": 1000
},
"channel": "Web"
}'cfhttp???¹Ԥ????ؿ???????
try{
apiKey = 'myKey';
requestURL = 'https://url/';
merchantAccount = 'myAccount';
amount = {
'value': 1000,
'currency': 'USD'
};
cfhttp(method="GET", url="#requestURL#/paymentMethods", result="data"){
cfhttpparam(name="x-API-key", type="header", value="#apiKey#");
cfhttpparam(name="content-type", type="header", value="application/json");
cfhttpparam(name="merchantAccount", type="formfield", value="#merchantAccount#");
cfhttpparam(name="countryCode", type="formfield", value="US");
cfhttpparam(name="amount", type="formfield", value="#amount#");
cfhttpparam(name="channel", type="formfield", value="web");
}
data = deserializeJSON(data);
WriteDump(data);
} catch(any e){
WriteDump(e);
}