#wullig
1 messages · Page 1 of 1 (latest)
Hi
Could you please summarize your latest follow up question ?
Hi, on react-native I'm trying to have a payment sheet that collect the payment method, and then a subscription with a trial is started.
I have my payment sheet now and once the payment is inputed, I have this callback clinet side
paymentMethod,
shouldSavePaymentMethod,
intentCreationCallback
) ```
So if I understood correctly, now I should call my server and pass the payment method, create a new customer (or fetch an existing one), create a subscription by passing the paymment method, is that it?
Yes
This is my snippet, one thing about the payment method, I should attach it to the customer, right?
'email' => $email,
'limit' => 1,
])->data;
$customer = $customersList[0] ?? null;
if (!$customer) {
$customer = $stripe->customers->create([
'email' => $email,
]);
}
$payment_method = $request->input('payment_method');
$price_id = '1234';
$subscription = $stripe->subscriptions->create([
'customer' => $customer->id,
'items' => [['price' => $price_id]],
'default_payment_method' => $payment_method->id,
'trial_period_days' => 3,
]);```
Or if I leave it like this is fine as well?
How are you collecting the PaymentMethod using SetupIntent ?
Mmh not sure, this is my clinet code to call the payment sheet
merchantDisplayName: "Example, Inc.",
intentConfiguration: {
mode: {
amount: 200,
currencyCode: "USD",
},
confirmHandler: confirmHandler,
},
returnURL: "com.myapp.com://stripe-redirect",
});```
And this collects the payment info
I encourage you to use SetupIntent in that case in order to keep the PaymenMethod attached to the customer.
Follow this screen for that use case
https://github.com/stripe/stripe-react-native/blob/master/example/src/screens/PaymentSheetWithSetupIntent.tsx
The problem with that is that it's starts the trial immediately. I want to have the payment info first, and then start the subscription with trial
Hi! I'm taking over this thread.
In this case start with a SetupIntent, and once it's succeeded create the Susbcription
Which guide do you reccomend to follow?
Speficially for React Native?