[英]update the main credit card on Stripe for a user
I'm trying to update the main credit card on Stripe for a user. 我正在尝试为用户更新Stripe上的主要信用卡。
My form is : 我的表格是:
<form id="update-card-form">
<div class="modal-body">
<div class="col-md-12">
<div class="form-group">
<label for="text-input">Credit card number</label>
<input type="number" data-stripe="number" class="form-control">
</div>
</div>
<div class="col-md-6">
<label for="text-input form-group col-md-12">Expiration date</label>
<div class="form-group col-md-6">
<input type="number" data-stripe="exp-month" class="form-control" placeholder="MM">
</div>
<div class="form-group col-md-6">
<input type="number" data-stripe="exp-year" class="form-control" placeholder="YYYY">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="text-input">Security number</label>
<input type="number" data-stripe="cvc" class="form-control">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="update-card-button"> Save</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</form>
I do not know how can I call the Stripe API to update the main credit card on the customer side. 我不知道如何调用Stripe API来更新客户方的主要信用卡。
I have actually the credit card id
and the customer id
. 我实际上有credit card id
和customer id
。
\Stripe\Stripe::setApiKey("your_stripe_api_key");
$cu = \Stripe\Customer::retrieve("cusomter_id_here");
$card = $cu->sources->retrieve("card_id_here");
$card->name = "Jane Austen";
$card->save();
more info in stripe documentation https://stripe.com/docs/api/php#update_card 条纹文档中的更多信息https://stripe.com/docs/api/php#update_card
edit you can update only address fields(eg address city, address_line1 etc), exp month, year, the name and the metadata. 编辑您只能更新地址字段(例如,地址城市,address_line1等),exp月,年,名称和元数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.