@ 2015-06-04T17:30:57Z <?php
/*********************************************************************************************************
【概要】
与信要求 サンプルコード
[プログラム言語]
PHP
[サーバサイド文字コード]
UTF-8
[使用ライブラリ]
PEARライブラリのHTTP_Requestモジュール
**********************************************************************************************************/
// API送信データ
$merchant_id = "62022";
$service_id = "001";
$cust_code = "SPSTestUser0001";
$order_id = "dcd297c04fc88974c7df19054171856b";
$item_id = "ITEMID00000000000000000000000001";
$item_name = "テスト商品";
$tax = "1";
$amount = "1";
$free1 = "";
$free2 = "";
$free3 = "";
$order_rowno = "";
$sps_cust_info_return_flg = "1";
$cc_number = "5250729026209007";
$cc_expiration = "201103";
$security_code = "798";
$cust_manage_flg = "0";
$encrypted_flg = "0";
$request_date = "20150605023010";
$limit_second = "";
$hashkey = "d7b6640cc5d286cbceab99b53bf74870cf6bce9c";
// Shift_JIS変換
$merchant_id = mb_convert_encoding($merchant_id, 'Shift_JIS', 'UTF-8');
$service_id = mb_convert_encoding($service_id, 'Shift_JIS', 'UTF-8');
$cust_code = mb_convert_encoding($cust_code, 'Shift_JIS', 'UTF-8');
$order_id = mb_convert_encoding($order_id, 'Shift_JIS', 'UTF-8');
$item_id = mb_convert_encoding($item_id, 'Shift_JIS', 'UTF-8');
$item_name = mb_convert_encoding($item_name, 'Shift_JIS', 'UTF-8');
$tax = mb_convert_encoding($tax, 'Shift_JIS', 'UTF-8');
$amount = mb_convert_encoding($amount, 'Shift_JIS', 'UTF-8');
$free1 = mb_convert_encoding($free1, 'Shift_JIS', 'UTF-8');
$free2 = mb_convert_encoding($free2, 'Shift_JIS', 'UTF-8');
$free3 = mb_convert_encoding($free3, 'Shift_JIS', 'UTF-8');
$order_rowno = mb_convert_encoding($order_rowno, 'Shift_JIS', 'UTF-8');
$sps_cust_info_return_flg = mb_convert_encoding($sps_cust_info_return_flg, 'Shift_JIS', 'UTF-8');
$cc_number = mb_convert_encoding($cc_number, 'Shift_JIS', 'UTF-8');
$cc_expiration = mb_convert_encoding($cc_expiration, 'Shift_JIS', 'UTF-8');
$security_code = mb_convert_encoding($security_code, 'Shift_JIS', 'UTF-8');
$cust_manage_flg = mb_convert_encoding($cust_manage_flg, 'Shift_JIS', 'UTF-8');
$encrypted_flg = mb_convert_encoding($encrypted_flg, 'Shift_JIS', 'UTF-8');
$request_date = mb_convert_encoding($request_date, 'Shift_JIS', 'UTF-8');
$limit_second = mb_convert_encoding($limit_second, 'Shift_JIS', 'UTF-8');
$hashkey = mb_convert_encoding($hashkey, 'Shift_JIS', 'UTF-8');
// 送信情報データ連結
$result =
$merchant_id .
$service_id .
$cust_code .
$order_id .
$item_id .
$item_name .
$tax .
$amount .
$free1 .
$free2 .
$free3 .
$order_rowno .
$sps_cust_info_return_flg .
$cc_number .
$cc_expiration .
$security_code .
$cust_manage_flg .
$encrypted_flg .
$request_date .
$limit_second .
$hashkey;
// SHA1変換
$sps_hashcode = sha1( $result );
// POSTデータ生成
$postdata =
"<?xml version=\"1.0\" encoding=\"Shift_JIS\"?>" .
"<sps-api-request id=\"ST01-00101-101\">" .
"<merchant_id>" . $merchant_id . "</merchant_id>" .
"<service_id>" . $service_id . "</service_id>" .
"<cust_code>" . $cust_code . "</cust_code>" .
"<order_id>" . $order_id . "</order_id>" .
"<item_id>" . $item_id . "</item_id>" .
"<item_name>" . base64_encode($item_name) . "</item_name>" .
"<tax>" . $tax . "</tax>" .
"<amount>" . $amount . "</amount>" .
"<free1>" . base64_encode($free1) . "</free1>" .
"<free2>" . base64_encode($free2) . "</free2>" .
"<free3>" . base64_encode($free3) . "</free3>" .
"<order_rowno>" . $order_rowno . "</order_rowno>" .
"<sps_cust_info_return_flg>" . $sps_cust_info_return_flg . "</sps_cust_info_return_flg>" .
"<dtls>" .
"</dtls>" .
"<pay_method_info>" .
"<cc_number>" . $cc_number . "</cc_number>" .
"<cc_expiration>" . $cc_expiration . "</cc_expiration>" .
"<security_code>" . $security_code . "</security_code>" .
"<cust_manage_flg>" . $cust_manage_flg . "</cust_manage_flg>" .
"</pay_method_info>" .
"<pay_option_manage>" .
"</pay_option_manage>" .
"<encrypted_flg>" . $encrypted_flg . "</encrypted_flg>" .
"<request_date>" . $request_date . "</request_date>" .
"<limit_second>" . $limit_second . "</limit_second>" .
"<sps_hashcode>" . $sps_hashcode . "</sps_hashcode>" .
"</sps-api-request>";
$url = "https://stbfep.sps-system.com/api/xmlapi.do";
// データ送信処理
echo $url.'<br/>';
echo $merchant_id . $service_id . ' - '. $hashkey.'<br/>';
echo $postdata.'<br/>';
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 , 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.34 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.4 , 8.3.6 https://stbfep.sps-system.com/api/xmlapi.do<br/>62022001 - d7b6640cc5d286cbceab99b53bf74870cf6bce9c<br/><?xml version="1.0" encoding="Shift_JIS"?><sps-api-request id="ST01-00101-101"><merchant_id>62022</merchant_id><service_id>001</service_id><cust_code>SPSTestUser0001</cust_code><order_id>dcd297c04fc88974c7df19054171856b</order_id><item_id>ITEMID00000000000000000000000001</item_id><item_name>g2WDWINnj6SVaQ==</item_name><tax>1</tax><amount>1</amount><free1></free1><free2></free2><free3></free3><order_rowno></order_rowno><sps_cust_info_return_flg>1</sps_cust_info_return_flg><dtls></dtls><pay_method_info><cc_number>5250729026209007</cc_number><cc_expiration>201103</cc_expiration><security_code>798</security_code><cust_manage_flg>0</cust_manage_flg></pay_method_info><pay_option_manage></pay_option_manage><encrypted_flg>0</encrypted_flg><request_date>20150605023010</request_date><limit_second></limit_second><sps_hashcode>34e5cef5a5bca528b1d1017302af96b15579bdaf</sps_hashcode></sps-api-request><br/> Output for 8.3.5 Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
https://stbfep.sps-system.com/api/xmlapi.do<br/>62022001 - d7b6640cc5d286cbceab99b53bf74870cf6bce9c<br/><?xml version="1.0" encoding="Shift_JIS"?><sps-api-request id="ST01-00101-101"><merchant_id>62022</merchant_id><service_id>001</service_id><cust_code>SPSTestUser0001</cust_code><order_id>dcd297c04fc88974c7df19054171856b</order_id><item_id>ITEMID00000000000000000000000001</item_id><item_name>g2WDWINnj6SVaQ==</item_name><tax>1</tax><amount>1</amount><free1></free1><free2></free2><free3></free3><order_rowno></order_rowno><sps_cust_info_return_flg>1</sps_cust_info_return_flg><dtls></dtls><pay_method_info><cc_number>5250729026209007</cc_number><cc_expiration>201103</cc_expiration><security_code>798</security_code><cust_manage_flg>0</cust_manage_flg></pay_method_info><pay_option_manage></pay_option_manage><encrypted_flg>0</encrypted_flg><request_date>20150605023010</request_date><limit_second></limit_second><sps_hashcode>34e5cef5a5bca528b1d1017302af96b15579bdaf</sps_hashcode></sps-api-request><br/> preferences:dark mode live preview
273 ms | 404 KiB | 385 Q