Author

Topic: Help needed finishing shopping cart integration (Read 943 times)

legendary
Activity: 1658
Merit: 1001
Sorry, BioMike, I guess I'm a little dense; where does this code go?

It goes in its own page.

Example:
Code: ("shoppingcart.php")



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

$plaintext_querystring="amount=".$amount."¤cy=".$currency."&payee_bcaddr=".$payee_bc_addr."&payee_name=".$payee_name."¬e=".$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");
sr. member
Activity: 322
Merit: 251
When you have the required info you need from the user. That will redirect them to the MyBitcoin page.
edd
donator
Activity: 1414
Merit: 1002
Sorry, BioMike, I guess I'm a little dense; where does this code go?
legendary
Activity: 1658
Merit: 1001
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."¤cy=".$currency."&payee_bcaddr=".$payee_bc_addr."&payee_name=".$payee_name."¬e=".$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.
full member
Activity: 126
Merit: 100
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.
edd
donator
Activity: 1414
Merit: 1002
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?
Jump to: