条纹支付 Android
Stripe payment Android
我想使用 Stripe 创建付款 Api 我在 android 中创建了所有内容,现在我可以获得令牌,但他说将其发送到您的服务器,但我找不到问题服务器代码或 Web 服务将获取我的令牌并使用它支付任何帮助
https://stripe.com/docs/mobile/android
Card card = new Card("4242424242424242", 12, 2017, "123");
Stripe stripe = new Stripe("pk_test_6pRNASCoBOKtIshFeQd4XMUh");
stripe.createToken(
card,
new TokenCallback() {
public void onSuccess(Token token) {
// Send token to your server
//what should i do in this step i want any code in php that do this job
}
public void onError(Exception error) {
// Show localized error message
Toast.makeText(getContext(),
error.getLocalizedString(getContext()),
Toast.LENGTH_LONG
).show();
}
}
)
将令牌和其他信息传递到 php 文件:
<?php
require_once('./config.php');
$token = $_POST['stripeToken'];
$customer = \Stripe\Customer::create(array(
'email' => 'customer@example.com',
'card' => $token
));
$charge = \Stripe\Charge::create(array(
'customer' => $customer->id,
'amount' => 5000,
'currency' => 'usd'
));
echo '<h1>Successfully charged .00!</h1>';
?>
我想使用 Stripe 创建付款 Api 我在 android 中创建了所有内容,现在我可以获得令牌,但他说将其发送到您的服务器,但我找不到问题服务器代码或 Web 服务将获取我的令牌并使用它支付任何帮助
https://stripe.com/docs/mobile/android
Card card = new Card("4242424242424242", 12, 2017, "123");
Stripe stripe = new Stripe("pk_test_6pRNASCoBOKtIshFeQd4XMUh");
stripe.createToken(
card,
new TokenCallback() {
public void onSuccess(Token token) {
// Send token to your server
//what should i do in this step i want any code in php that do this job
}
public void onError(Exception error) {
// Show localized error message
Toast.makeText(getContext(),
error.getLocalizedString(getContext()),
Toast.LENGTH_LONG
).show();
}
}
)
将令牌和其他信息传递到 php 文件:
<?php
require_once('./config.php');
$token = $_POST['stripeToken'];
$customer = \Stripe\Customer::create(array(
'email' => 'customer@example.com',
'card' => $token
));
$charge = \Stripe\Charge::create(array(
'customer' => $customer->id,
'amount' => 5000,
'currency' => 'usd'
));
echo '<h1>Successfully charged .00!</h1>';
?>