2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

stripeでサブスク決済。

Last updated at Posted at 2020-10-31

stripeでサブスク決済を作成しました。
作成にあたって住所(請求書)の部分が制作するに困っている方が
いるかも知れないということでコードを抜粋して記載します。
因みにnameはファーストネームとラストネームに分けて渡すことは
可能だったと思います。

js側
		const { paymentMethod, error } = await stripe.createPaymentMethod({
			type: 'card',
			card: cardElement,
			billing_details: {
				name: last_name + " " + first_name,
				email: email,
				phone: phone,
				address:{line1:address,country:"JP"},
			}
		});
php側
		$customer = \Stripe\Customer::create([
			'payment_method' => $token,
			'name' => $name,
			"email" => $email,
			"phone" => $phone,
			'address'=>[
				'line1'=>$address,
				'country'=>'JP'
			],
			'description' => $test_name,
			'invoice_settings' => [
				'default_payment_method' => $token,
			],
		]);
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?