Bitcoin Forum
December 04, 2016, 08:25:58 AM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Help needed finishing shopping cart integration  (Read 715 times)
edd
Donator
Legendary
*
Offline Offline

Activity: 1372



View Profile WWW
May 07, 2011, 04:08:20 PM
 #1

I've got just about everything set up for my site to accepts bitcoins as payment but I'd like to customize my shopping cart a bit more. I'm not a developer, so I need a bit of assistance configuring some variables and sending data to the appropriate places. Right now, I have the MyBitcoin SCI working fine but only using one set price for each generated button. How do I get it to change the amount based on the total in my customers' shopping carts?

Still around.
1480839958
Hero Member
*
Offline Offline

Posts: 1480839958

View Profile Personal Message (Offline)

Ignore
1480839958
Reply with quote  #2

1480839958
Report to moderator
1480839958
Hero Member
*
Offline Offline

Posts: 1480839958

View Profile Personal Message (Offline)

Ignore
1480839958
Reply with quote  #2

1480839958
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1480839958
Hero Member
*
Offline Offline

Posts: 1480839958

View Profile Personal Message (Offline)

Ignore
1480839958
Reply with quote  #2

1480839958
Report to moderator
1480839958
Hero Member
*
Offline Offline

Posts: 1480839958

View Profile Personal Message (Offline)

Ignore
1480839958
Reply with quote  #2

1480839958
Report to moderator
1480839958
Hero Member
*
Offline Offline

Posts: 1480839958

View Profile Personal Message (Offline)

Ignore
1480839958
Reply with quote  #2

1480839958
Report to moderator
unfinishe
Full Member
***
Offline Offline

Activity: 126



View Profile
May 07, 2011, 07:04:21 PM
 #2

I haven't used the SCI myself, but looking at it, it seems that the key is to use the function mbc_encryptformdata()

If you look at the file sci-auto-sample.php in the toolkit, there's an example of how to use it at line 34. You should be able to just change the $amount variable to the price of the shopping cart.

Check out the results from my Bitcoin Survey Project!
https://bitcointalk.org/index.php?topic=88927.0
BioMike
Legendary
*
Offline Offline

Activity: 1256


View Profile
May 07, 2011, 07:11:24 PM
 #3

After presenting the form to the user to fill in the amount (or other vars), send the data through the following code:

Code:
$plaintext_querystring="amount=".$amount."&currency=".$currency."&payee_bcaddr=".$payee_bc_addr."&payee_name=".$payee_name."&note=".$note."&success_url=".$success_url."&cancel_url=".$cancel_url."&baggage=".$baggage;

$result=mbc_encryptformdata($plaintext_querystring);

$redirect_url="https://www.mybitcoin.com/sci/paypage.php?t=".$result['SCI Encrypted Form Data Token'];
header("Location: $redirect_url");

You can also get most vars from your own database/cart and fill in the blanks from there.
edd
Donator
Legendary
*
Offline Offline

Activity: 1372



View Profile WWW
May 07, 2011, 07:53:04 PM
 #4

Sorry, BioMike, I guess I'm a little dense; where does this code go?

Still around.
lulzplzkthx
Sr. Member
****
Offline Offline

Activity: 322



View Profile WWW
May 07, 2011, 08:02:05 PM
 #5

When you have the required info you need from the user. That will redirect them to the MyBitcoin page.

BioMike
Legendary
*
Offline Offline

Activity: 1256


View Profile
May 07, 2011, 08:07:29 PM
 #6

Sorry, BioMike, I guess I'm a little dense; where does this code go?

It goes in its own page.

Example:
Code: ("shoppingcart.php")
<form action="mybitcoin.php" method="post>
...
input fields that you need in mybitcoin.php (or you get them from a checkout db)
...
<input type="submit" value="Checkout with MyBitcoin">
</form>

Code: ("mybitcoin.php")
Read the fields from shoppingcart.php or checkout database and parse them into $plaintext_querystring

$plaintext_querystring="amount=".$amount."&currency=".$currency."&payee_bcaddr=".$payee_bc_addr."&payee_name=".$payee_name."&note=".$note."&success_url=".$success_url."&cancel_url=".$cancel_url."&baggage=".$baggage;

$result=mbc_encryptformdata($plaintext_querystring);

$redirect_url="https://www.mybitcoin.com/sci/paypage.php?t=".$result['SCI Encrypted Form Data Token'];
header("Location: $redirect_url");
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!