I'd like to introduce the coincheck API so that I can use Bitcoin to make payments on my EC site.
For that purpose, I would like to generate a payment button.
I am using PHP.
coincheck API documentation
https://coincheck.com/en/documents/payment/api/auth
https://coincheck.com/en/documents/payment/api/payment-button
Teach us.
When the return value is displayed
string (50)"{"success": false,"error":"invalid authentication"}"
This way, I think that authentication is not successful.
It seems that the html that displays the button will return if it is normal.
source code:$strUrl = "https://coincheck.com/api/ec/buttons";
$intNonce = time ();
$strCallbackUrl = "https://www.google.com/";
$arrQuery = array ("button" =>array (
"name" =>"Order # 123",
"currency" =>"JPY",
"amount" =>5000,
"callback_url" =>$strCallbackUrl,
"max_times" =>1
));
$strAccessSecret = "Actually contains the private key";
$strMessage = $intNonce. $strUrl. http_build_query ($arrQuery);
# sign with hmac
$strSignature = hash_hmac ("sha256", $strMessage, $strAccessSecret);
$headers = array (
"ACCESS-KEY: Actually contains the API key",
"ACCESS-SIGNATURE:". $StrSignature,
"ACCESS-NONCE:". $IntNonce
);
$url = "https://coincheck.com/api/ec/buttons";
$ch = curl_init ();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
// add header
curl_setopt ($ch, CURLOPT_HTTPHEADER, $headers);
// add postdata
$post_data = array ('button [name]' =>"Order # 123", 'button [currency]' =>"JPY", "button [display_currency]" =>"JPY", 'button [amount ] '=>5000,' button [callback_url] '=>"http://www.example.com/coincheck/callback", "button [success_url]" =>"http://google.co. jp/"," button [max_times] "=>1," button [include_name] "=>true," button [include_email] "=>true," button [include_address] "=>false," button [custom] "=>" 123 "," button [notify_mispayment] "=>true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query ($post_data));
$html = curl_exec ($ch);
var_dump ($html);
curl_close ($ch);
-
Answer # 1
-
Answer # 2
Because it is related to the introduction of individual services that require ID etc., it is difficult to check errors etc. so it is difficult to answer I think.
In the contact page on your service
If you need installation support, please contact us from the "Inquiry Form" below, stating that separately.
, I think that direct inquiries can be solved quickly.
-
Answer # 3
ACCESS-SIGNATURE is the result of signing the ACCESS-NONCE URL request body into a character string and concatenating it using the secret key of the API key in HMAC-SHA256 hash format.
Related articles
- i would like to know if there is a download method for old php (5640) for windows
- i would like you to explain the parts that you could not understand in the php reference book
- php - i would like to know how to write regular expressions
- php - i would like to know about relative paths
- php - i would like to know in which language this voting system can be done
- php - i would like to use gpio of raspberry pi on the web
- php - i would like to send the repeated contents in form
- php - i would like to know the wordpress development procedure on site
- php - woocommerce for japan: i would like to add the day of the week to the "date format" of the shipping method
- php - a new project is created in laravel 803 i would like to create it in 830
- i would like to know how to operate sql that calculates the aggregation period from the deadline in php
- php - i would like to know how to get each past numerical value with "ahrefs api"
- php - i want to implement an editing function i would like advice
- php - i would like to know how this code works
- i would like to know the cause of the error php
- i would like to use phpspreadsheet
- php - i would like to aggregate logs by day of articles posted for half a year there are too many date tables and an error occur
- i would like to know the libraries and frameworks suitable for parallel processing (api kick) in php
- php - how to introduce an image anywhere in the text field of html
- regarding the acquisition and output of php legal api
- [execution of python from php] how to describe environment variables of requests in php file
- about webphp and apiphp when using vuejs with laravel
- php - jwt authentication fails and the token cannot be obtained
- i want to run javascript eventlistener on the html button element obtained from api (php)
Since I have never used Coincheck and I am sorry for the unverified content, it is probably the request parameter used when generating
ACCESS-SIGNATURE
and the actual request parameter used I think that is because of the difference.https://coincheck.com/en/documents/payment/api/auth
So, if you use
$arrQuery
as shown below, I think that authentication will be successful for the time being.