銀行振込-1: Payment Intentsにcustomer_idが必須
● 口座情報がCustomerに紐づく
○ 会員機能が無くても、
Customerを作ろう
● 「どの国の銀行振込か?」の
指定などで、ちょっと引数多め
● 日本円以外の指定はエラーになる
● Customerに残高がある場合、
相殺後の残高が入金額になる
● 入金が必要な場合、
next_actionから口座情報他を取得可能
17
JP_Stripes DeepDive 2022/4
https://github.com/serverless-nextjs/serverless-next.js
const customer = await stripe.customers.create();
const intent = await stripe.paymentIntents.create({
amount: 19000,
currency: 'jpy',
customer: customer.id,
payment_method_types: [ 'customer_balance' ],
payment_method_data: { type: 'customer_balance' },
payment_method_options: {
customer_balance: {
funding_type: 'bank_transfer',
bank_transfer: { type: 'jp_bank_transfer' },
},
},
confirm: true,
});