- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在为 Stripe 苦苦挣扎。我正在使用 PHP,我正在尝试建立一个没有 CMS 的简单商店。想知道如何将金额传递到 charge.php 中,以便我可以针对不同的商品收取不同的金额产品。这是我的代码:
$charge = Stripe_Charge::create(array(
'customer' => $customer->id,
'amount' => 1900;,
'currency' => 'gbp'
));
这是 index.php 中的代码 - 我想向客户收取下表中“数据量”中的任何内容。不太清楚该怎么做。
<form action="inc/charge.php" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="<?php echo $stripe['publishable_key']; ?>"
data-amount="1900"
data-currency="GBP"
data-name="Pure - Tumblr Theme"
data-allow-remember-me="false"
data-description="Premium Tumblr Theme"
data-image="/128x128.png">
</script>
</form>
最佳答案
更全面,从 index.php 到 charge.php 而不是相反。
<?php
#set your variables
$amount = 500;
$name = 'My Company';
$currency = 'gbp';
$description = 'Value Plan';
$uid = get->your->uid;
$email = get->your->email;
?>
<center><form action="../charge.php" method="post">
<!-- make these hidden input types for the post action to charge.php -->
<input type="hidden" name="amount" value="<?php echo $amount?>">
<input type="hidden" name="name" value="<?php echo $name;?>">
<input type="hidden" name="currency" value="<?php echo $currency;?>">
<input type="hidden" name="description" value="<?php echo $description;?>">
<input type="hidden" name="uid" value="<?php echo $uid;?>">
<input type="hidden" name="email" value="<?php echo $email;?>">
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key = "<?php echo $stripe['publishable_key']; ?>"
data-amount = "<?php echo $amount;?>"
data-name = "<?php echo $name;?>"
data-currency = "<?php echo $currency;?>"
data-description = "<?php echo $description;?>"
data-email = "<?php echo $user->data()->email; ?>"
data-billing-address = "true"
data-allow-remember-me = "false"
>
</script>
</form></center>
然后在charge.php中你可以调用你隐藏在index.php中的输入值
<?php
$token = $_POST['stripeToken'];
$email = $_POST['email'];
$uid = $_POST['uid'];
$currency = $_POST['currency'];
$amount = $_POST['amount'];
$description = $_POST['description'];
#This is the standard try catch block stripe suggests
try{
$charge = Stripe_Charge::create(array(
"amount" => $amount,
"currency" => $currency,
"customer" => $charge_to,
"description" => $description
));
} catch(Stripe_CardError $e) {
$error = $e->getMessage();
// Since it's a decline, Stripe_CardError will be caught
$body = $e->getJsonBody();
$err = $body['error'];
print('Status is:' . $e->getHttpStatus() . "\n");
print('Type is:' . $err['type'] . "\n");
print('Code is:' . $err['code'] . "\n");
// param is '' in this case
print('Param is:' . $err['param'] . "\n");
print('Message is:' . $err['message'] . "\n");
} catch (Stripe_InvalidRequestError $e) {
// Invalid parameters were supplied to Stripe's API
} catch (Stripe_AuthenticationError $e) {
// Authentication with Stripe's API failed
// (maybe you changed API keys recently)
} catch (Stripe_ApiConnectionError $e) {
// Network communication with Stripe failed
} catch (Stripe_Error $e) {
// Display a very generic error to the user, and maybe send
// yourself an email
} catch (Exception $e) {
// Something else happened, completely unrelated to Stripe
}
?>
关于javascript - Stripe 动态支付,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23695085/
我可以在不使用收款人信用卡号的情况下将资金从我的 Stripe 账户发送到另一个 Stripe 账户吗?在我的网站中,我希望管理员将资金从他的帐户转移到用户的条纹帐户(而不是用户的银行帐户)。用户的
我曾经有 Angular Stripe Checkout 表单,我正在尝试将表单更新为新的 Stripe Card Elements这是最近推出的。 删除表单输入字段并将其替换为条纹卡片元素后,我的表
我的目标是为产品创建一个简单的支付页面。 在官方文档中,它说在服务器端需要生成 token 才能创建交易,使用: stripe.paymentIntents.create({ amount: re
我是 strip 的新手,打算使用 strip token /收费 api,但 strip 文档说 paymentIntent api 是新的方法。我可以使用任何人吗或 PaymentIntent 是
我正在开发一个项目,我们正在为 Node 使用 Stripe 库。我们还想在这个项目上使用 TypeScript。 我发现 Stripe 没有提供官方 TypeScript 定义,但我找到了一些社区定
通常在使用 stripe 时我可以创建产品并添加税率、运费。付款后我可以创建发票。我想在使用连接帐户时做同样的事情。在我的应用程序中,我希望用户创建商店,并且该商店的产品将保存到他们连接的 Strip
假设我们已经设置了一个 Stripe 订阅计划。即 30 美元/月。 (注意:账单/账户信息存储在 Stripe 上。) 假设我们想为客户提供提前购买一年服务的选项,如果他们这样做,他们只需支付 25
我们知道 Stripe 支持多张信用卡。一个是 default_card。关于这张 Stripe 多张卡片,我需要知道一些答案。 假设我想向我的客户收费,他的 Stripe 个人资料中有 3 张信用卡
有没有办法根据为特定客户生成的最后一张发票过滤发票结果? 穿过 Stripe documentation我可以看到有可能获得即将到来的发票,但我找不到获得最后生成的发票的方法。 最佳答案 如果您使用
我正在使用 Stripe 为客户订阅月度计划。中途客户可能会减少计划数量。所以,在即将开出的发票有时会是负数。 带有负金额的发票行是否意味着客户将这些金额退还到他们的卡中? 谢谢 最佳答案 是的,负发
我正在使用定期计划和电子邮件地址在 Stripe(使用测试模式)中创建客户。到目前为止,一切都按我的预期工作:当客户创建并注册到定期计划时,他们会自动在计划的第一期收费。我所拥有的几乎是逐字逐句wha
我正在尝试使用 Stripe checkout.js 订阅,然后使用 PHP 订阅客户。我的问题是获取他们的电子邮件地址。在文档中找不到任何有用的东西。 文档在这里:https://stripe.co
我在两部分付款过程中使用 Stripe。 IE。 使用 capture = false 对调用 Charge 对象的卡进行预授权 做一些数据库工作 使用电荷捕获为卡充电 如果第 2 步失败(即数据库工
我们使用 Stripe 作为支付网关,我们有一个年度计划,即该计划的计费周期为 1 年。 在计费周期内,用户可以更新选择更多席位,这将导致增加订阅计划的数量。 Subscription subscri
我正在使用 PHP Stripe Payment 表单来收款。付款似乎通过 OK 并在成功完成后将用户带到确认页面。我处于测试模式,能够看到显示在仪表板“付款”部分的付款。但是,当我单击仪表板的“主页
我正在构建一个市场应用程序。我正在使用 Stripe 接受买家付款并将百分比转移给卖家。但是,stripe 只能让您从 Stripe 余额中转移。因此,如果我接受需要 2 个工作日才能显示在我的 st
正如我们所知,Stripe 每张信用卡收费 2.9% + 30 美分。因此,对于每 1 美元的交易,Stripe 大约需要 33 美分。有没有办法批量处理多个 1 美元的交易(由同一客户)并完全收费?
我有一个关于 Stripe 的订阅计划,并将其用于按座位定价。 具体用例是: 客户之前已付款,因此数据库中的客户 ID 和订阅 ID 他们在一个月内删除了所有用户 下个月他们又添加了一个用户 我希望结
在Stripe API文档中,它们显示您可以在客户上应用优惠券。 cust = Stripe::Customer.retrieve("cus_asdasdad") cust.coupon = "COU
我在订阅中添加发票项目时遇到问题,目前无法正常工作。 我已经在 strip 上创建了一个发票项目,并且希望该发票项目包含在定期付款中 这是我的代码,它在第一个发票上添加了一个发票项目,但在下一个发票上
我是一名优秀的程序员,十分优秀!