在数据库中存储条带定期付款信息 [英] Storing Stripe Recurring Payment information in Database

查看:29
本文介绍了在数据库中存储条带定期付款信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Stripe 支付网关的新手,我创建了一个 Stripe 帐户,我在其中拥有我的计划和订阅.它工作正常.以下是我的计划和订阅的图像格式.

I am new to stripe payment gateway and I have created a stripe account where I have my plans and subscriptions. It is working fine. Below are my plans and subscriptions in image format.

我的 Stripe 订阅计划

My Stripe subscription plan

我的条纹订阅

下面是我的结帐页面

<form action="charge.php" method="POST">
<script
    src="https://checkout.stripe.com/checkout.js" class="stripe-button"
    data-key="pk_test_ZCRfEl8XeRIbPHGIifY3THYC"
    data-amount="999"
    data-name="Demo Site"
    data-description="Widget"
    data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
    data-locale="auto">
</script>

当以条带方式进行定期付款时,我想将客户信息(例如交易金额、客户 ID 等)插入我的数据库中.有人可以帮我吗?

I want to insert customer info like amount of transaction, customer id etc.., into my database when recurring payment occurs in stripe method. Can anyone help me?

推荐答案

支付成功后可以使用 $customer 变量进行处理.您可以通过 $customer如果您想在支付成功后访问收款卡和重复信息,您需要做

You can do with $customer varibale after successful Payment .you can Collect whole information about payment by $customer If you want to access the collecting card and recurring information after successful payment, you'd need to do

$StripeId = $customer['id'];    
$card = $customer->sources->data[0];
$Stripe_City = $card->address_city;
$Stripe_Country = $card->address_country;
$Stripe_Address = $card->address_line1;
$Stripe_State = $card->address_state;
$Stripe_Zip = $card->address_zip;
$Stripe_card = $card->last4;
$Stripe_Brand = $card->brand;

为了存储有关客户的信息,您需要在流程中添加:

for storing information about customer you need to add this on process:

$customer = Stripe_Customer::create(array(
'email' => $_SESSION['userEmail'],
'card' => $_POST['stripeToken'],
'plan' => $plan_id,
 ));`

stripe 还为您提供有关付款的信息,通过 print_r($customer) 查看所有对象.一个 $customer 可以同时拥有多个来源.Customer 上的 source 属性是一个列表,如此处所述.

stripe also provide you information about payment, see all object by print_r($customer).A $customer can have more than one source at the same time. The source property on the Customer is a list as documented here.

这篇关于在数据库中存储条带定期付款信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆