Bitcoin Forum
June 30, 2024, 10:54:09 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Receive Bitcoin via Coinpayments  (Read 320 times)
tendemo (OP)
Newbie
*
Offline Offline

Activity: 86
Merit: 0



View Profile
October 10, 2017, 02:47:53 PM
 #1

Hi I setup an Advanced form via coinpayments to receive Bitcoin payments. The form works pretty well but I would like to also follow up the status of my payments from my site. Can someone kindly give me an example of an API or using IPN consdering the transaction will have a unique invoice. Thanks
N.B I have my API keys and secret setup with permissions too.
retprogramisto
Member
**
Offline Offline

Activity: 149
Merit: 34

💡 Websites, scripts for BTC web4crypto.xyz


View Profile WWW
October 10, 2017, 08:42:31 PM
 #2

CoinPayments documentation: https://www.coinpayments.net/apidoc
Sample code: https://www.coinpayments.net/apidoc-code
IPN: https://www.coinpayments.net/merchant-tools-ipn
WooCommerce plugin (as example): https://github.com/wp-plugins/coinpayments-payment-gateway-for-woocommerce/blob/master/class-wc-gateway-coinpayments.php

➡️  💡  𝗪𝗲𝗯𝟰𝗖𝗿𝘆𝗽𝘁𝗼  💡  ⬅️
Websites, scripts, crypto integration for BTC
✔️ Free consultation at Web4Crypto.xyz
tendemo (OP)
Newbie
*
Offline Offline

Activity: 86
Merit: 0



View Profile
October 10, 2017, 08:47:10 PM
 #3

Thanks Ive had a look at those and ended up using the Advanced payment button. What I need to know is how to make the proper API call format , to get a transactions status using its Transaction ID. My Attempts have ended up with {"error":"No HMAC signature sent","result":[]} Thanks
servsec
Newbie
*
Offline Offline

Activity: 76
Merit: 0


View Profile
October 10, 2017, 10:10:27 PM
 #4

Thanks Ive had a look at those and ended up using the Advanced payment button. What I need to know is how to make the proper API call format , to get a transactions status using its Transaction ID. My Attempts have ended up with {"error":"No HMAC signature sent","result":[]} Thanks
You can generate checkout links with your Merchant ID at coinpaylink.com
tendemo (OP)
Newbie
*
Offline Offline

Activity: 86
Merit: 0



View Profile
October 10, 2017, 10:15:37 PM
 #5

Thanks , generating the links isnt an issue following up the status of a payment is what Im actually after. With such a link or using a payment button how would I proceed to get the status of a payment. I'd prefer using Advanced Buttons as they have have payment IDs. Thanks
retprogramisto
Member
**
Offline Offline

Activity: 149
Merit: 34

💡 Websites, scripts for BTC web4crypto.xyz


View Profile WWW
October 11, 2017, 04:34:30 AM
Last edit: October 11, 2017, 05:08:30 AM by retprogramisto
Merited by HCP (1)
 #6

Edit: If you receive the error "No HMAC signature sent" generate a IPN secret here: https://www.coinpayments.net/index.php?cmd=acct_settings and add it to your callback code.

Edit 2: If you don't want to use IPN, you can use this API code: https://www.coinpayments.net/downloads/api-example.phps

Code:
$req = array(
'txid' => 'transaction_id', // e.g. 25fc307cc7a28d0cc18369f1775ea8e5be8495b33a74ae18a1a9c430b9d8a49c
'full' => '1'
);
print_r(coinpayments_api_call('get_tx_info',$req));
More info here: https://www.coinpayments.net/apidoc-get-tx-info



To check payment status you can use IPN (instant payment notification)

To track payments you can set the button "custom" field to the order ID.

Create a callback PHP page on your server with this code:
https://www.coinpayments.net/downloads/cpipn.phps

Change "ipn_url" field to the url of your callback script:
https://www.coinpayments.net/merchant-tools-buttons

This code deals with payment status:
Code:
    if ($status >= 100 || $status == 2) {
        // payment is complete or queued for nightly payout, success
        // e.g. now update orders database with "payment complete"
    } else if ($status < 0) {
        //payment error, this is usually final but payments will sometimes be reopened if there was no exchange rate conversion or with seller consent
    } else {
        //payment is pending, you can optionally add a note to the order page
        // e.g. now update orders database with "payment pending"
    }

Relevant variables:
Code:
$_POST['status'] $_POST['received_amount'] $_POST['received_confirms']

See possible payment status here:
https://www.coinpayments.net/merchant-tools-ipn

➡️  💡  𝗪𝗲𝗯𝟰𝗖𝗿𝘆𝗽𝘁𝗼  💡  ⬅️
Websites, scripts, crypto integration for BTC
✔️ Free consultation at Web4Crypto.xyz
tendemo (OP)
Newbie
*
Offline Offline

Activity: 86
Merit: 0



View Profile
October 11, 2017, 08:30:25 AM
 #7

Thanks so muck makes more sense now and would definitely be able now to glide through. Smiley
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!