views:

178

answers:

1

Hi ,

Am doing one project ,

For that my client asked amazon payment gateway ,

So now i started exploring amazon payment gateway ,

This is the first time am looking the amazon payment gateway ,

I have registered in amazon ,

Please tell me PHP CODE snippet for amazon payment gateway ,

Thanks

A: 

Amazon has different payment products. Checkout by Amazon is their usual product, but it works best for products that you actually ship by mail. SimplePay is probably best for electronic goods and services - which I discovered too late. Make sure you sign up for the right thing. :)

Here's the PHP code for a "Pay Now" button for one item using a POST form submission:

// Key from Amazon
$merchant_id = 'your_id';
$aws_access_key_id = 'your_access_key'; 
$aws_secret_access_key = 'your_secret_access_key';

// Set up cart
$form['aws_access_key_id'] = $aws_access_key_id;
$form['currency_code'] = 'USD';
$form['item_merchant_id_1'] = $merchant_id;
$form['item_price_1'] = $price;
$form['item_quantity_1'] = $quantity;
$form['item_sku_1'] = $sku;
$form['item_title_1'] = $item_name;
ksort($form);

// Encode order as string and calculate signature
$order = '';
foreach ($form as $key => $value) {
  $order .= $key . "=" . rawurlencode($value) . "&";
}
$form['merchant_signature'] = base64_encode(hash_hmac('sha1', $order, $aws_secret_access_key, true));

// Return string with Amazon javascript and HTML form
// Assumes you already have jQuery loaded elsewhere on page
// URL's link to live site, not sandbox!
$amazon_order_html = 
  '<script type="text/javascript" src="https://images-na.ssl-images-amazon.com/images/G/01/cba/js/widget/widget.js"&gt;&lt;/script&gt;
  <form method="post" action="https://payments.amazon.com/checkout/' . $merchant_id . '">';
foreach ( $form as $key => $value ) {   
  $amazon_order_html .= '<input type="hidden" name="' . $key . '" value="' . $value . '" />';
}
$amazon_order_html .= '<input alt="Checkout with Amazon Payments" src="https://payments.amazon.com/gp/cba/button?ie=UTF8&amp;color=orange&amp;background=white&amp;cartOwnerId=' . $merchant_id . '&size=large" type="image"></form>';

return $amazon_order_html;
Summer
i have your_access_key and your_secret_access_key , Wher ei go for merchant ID, can u tell me URL for merchant ID
Bharanikumar
Where i find my merchant id.....
Bharanikumar
Account Number is Merchant Id ? Or merchant id somthing Diff ?
Bharanikumar