我在使用Stripe Connect
處理付款時遇到了一些麻煩。出於某種原因,只要我提交我的表單,我收到此錯誤:條紋付款問題 - 網絡錯誤,您沒有被收費
發生網絡錯誤,並且您沒有收費。請再試一次
他們建立我的系統的方式是用戶可以使用Stripe登錄,並將從Stripe中發回的以下詳細信息與用戶ID一起保存到數據庫中。
- 的access_token
- refresh_token
- 發佈的關鍵
在我的付款頁面上,我有這樣的腳本:
Stripe.setPublishableKey('<?= $publishable_key; ?>');
var stripeResponseHandler = function(status, response) {
var $form = $('#payment-form');
$form.find('.form-error').text("")
$form.find('.error').removeClass("error")
validate = validateFields();
if (response.error) {
error = 0;
// Show the errors on the form
if (response.error.message == "This card number looks invalid"){
error = error + 1;
$form.find('.card_num').text(response.error.message);
$('#dcard_num').addClass("error");
}
if (response.error.message == "Your card number is incorrect."){
error = error + 1;
$form.find('.card_num').text(response.error.message);
$('#dcard_num').addClass("error");
}
if (response.error.message == "Your card's expiration year is invalid."){
error = error + 1;
$form.find('.exp').text(response.error.message);
$('#dexp').addClass("error");
}
if (response.error.message == "Your card's expiration month is invalid."){
error = error + 1;
$form.find('.exp').text(response.error.message);
$('#dexp').addClass("error");
}
if (response.error.message == "Your card's security code is invalid."){
error = error + 1;
$form.find('.cvc').text(response.error.message);
$('#dcvc').addClass("error");
}
if (error == 0){
$form.find('.payment-errors').text(response.error.message);
}
$form.find('button').prop('disabled', false);
} else {
if (validate == 1){
// token contains id, last4, and card type
var token = response.id;
// Insert the token into the form so it gets submitted to the server
$form.append($('<input type="hidden" name="stripeToken" />').val(token));
// and re-submit
$form.get(0).submit();
}
}
};
出於某種原因,確認不會發生,我不要獲取卡信息的標記。其結果是我的代碼,在那裏我居然收取用戶的下一部分沒有得到執行:
global $wpdb;
$author_id = get_the_author_meta('id');
$stripe_connect_account = $wpdb->get_row("SELECT * FROM wp_stripe_connect WHERE wp_user_id = $author_id", ARRAY_A);
if($stripe_connect_account != null){
$publishable_key = $stripe_connect_account['stripe_publishable_key'];
$secret_key = $stripe_connect_account['stripe_access_token'];
}
$charging = chargeWithCustomer($secret_key, $amountToDonate, $currency_stripe, $stripe_usr_id);
這是chargeWithCustomer
功能:
function chargeWithCustomer($secret_key, $amountToDonate, $currency, $customer) {
require_once('plugin/Stripe.php');
Stripe::setApiKey($secret_key);
$charging = Stripe_Charge::create(array("amount" => $amountToDonate,
"currency" => $currency,
"customer" => $customer,
"description" => ""));
return $charging;
}
如果有人可以幫助我在這個問題上我感謝你。我很困惑,我在哪裏出錯,我無法在Stripes文檔中找到答案。
感謝您的有益迴應,我會研究你所說的話,希望我能對其進行分類。 – Javacadabra 2014-11-21 10:34:40
是的...和你的歡迎.. :) – CODeeerrrrrrrr 2014-11-21 10:36:47