I'm trying to update the main credit card on Stripe for a user.
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.
I have actually the credit card id
and the customer id
.
答案 0 :(得分:0)
\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();
条纹文档中的更多信息 https://stripe.com/docs/api/php#update_card
修改强> 您只能更新地址字段(例如地址城市,地址_行1等),月份,年份,名称和元数据。