我正在做一个项目,
为此我的客户问亚马逊支付网关,
所以现在我开始探索亚马逊支付网关,
这是我第一次看到亚马逊支付网关,
我已在亚马逊支付网关注册,
请告诉我amazon支付网关的PHP CODE代码段,
由于
答案 0 :(得分:3)
亚马逊有不同的付款产品。 Checkout by Amazon是他们常用的产品,但它最适合您实际通过邮件发送的产品。 SimplePay可能最适合电子产品和服务 - 我发现太晚了。确保您注册正确的事情。 :)
以下是使用POST表单提交的一个项目的“立即付款”按钮的PHP代码:
// 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"></script>
<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&color=orange&background=white&cartOwnerId=' . $merchant_id . '&size=large" type="image"></form>';
return $amazon_order_html;
答案 1 :(得分:0)
对于创建帐户时的简单付款,系统会向用户提供一个沙盒访问权限,您可以在此访问此网址找到“商家代码”:https://sandbox.simplepay.hu/admin/partner/account/id(partnerid)