Bitcoin Forum
May 04, 2024, 05:56:46 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Help needed finishing shopping cart integration  (Read 921 times)
edd (OP)
Donator
Legendary
*
Offline Offline

Activity: 1414
Merit: 1001



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.
If you want to be a moderator, report many posts with accuracy. You will be noticed.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714845406
Hero Member
*
Offline Offline

Posts: 1714845406

View Profile Personal Message (Offline)

Ignore
1714845406
Reply with quote  #2

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

Activity: 126
Merit: 100



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: 1658
Merit: 1001


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 (OP)
Donator
Legendary
*
Offline Offline

Activity: 1414
Merit: 1001



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
Merit: 251



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: 1658
Merit: 1001


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:  

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