onCreateIntent
Called when the customer confirms the payment or setup.
Your implementation should create and optionally confirm a PaymentIntent or SetupIntent on your server and return its client secret or an error if one occurred.
Parameters
The PaymentMethod representing the customer's payment details. If your server needs the payment method, send PaymentMethod.id to your server and have it fetch the PaymentMethod object. Otherwise, you can ignore this. Don't send other properties besides the ID to your server.
This is true
if
The customer selected the "Save this payment method for future use" checkbox.
The IntentConfiguration.Mode.Payment.setupFutureUse is set to SetupFutureUse.OffSession or SetupFutureUse.OnSession.
The IntentConfiguration.Mode.Payment.PaymentMethodOptions.setupFutureUsageValues has SetupFutureUse.OffSession or SetupFutureUse.OnSession for the PaymentMethod.Type. Set
setup_future_usage
on the PaymentIntent tooff_session
if this istrue
.