#videovillain
1 messages · Page 1 of 1 (latest)
Hi! Let me help you with this.
I am not sure all functionality will be working. Have you tried this?
I have a bit
I am currently using the Pricing Tables as is and they display inside my Vue3 app, but then when you pay it sends you out of the app
I know there is a "return" url you can set, but we would rather just display everything in the app
I'm just curious if you know of any reason this wouldn't work
Pricing table works with Checkout Session once a customer choose a price you can't keep them in your website for the purchase
unless you implement your own pricing table and your own checkout form with Stripe Element
hmmm
but what about a browser inside our app?
isn't that just like any other browser?
I don't know that, but it's not recommended to use webview in mobile apps. You can give it a try
but in that case I think you should create your own mobile pricing table with Checkout forms
not recommended in general or by Stripe do you mean?
ahh okay
and very poor in performance
Okay, well I actually have the elements style made too
but I'm struggling with something
In this section: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
It shows the "Your subscription"
"premium plan" 15$billed monthly
Totale 15$
but my element never shows that
and it enver shows the payment options
Is that part of the element when making a subscription or is that built by the developer? if by the developer, it doesn't seem to be part of this "guide"
This is my table with my 3 payment options, each with monthly/yearly the language is japanese though:
and when you hit the green button, its sends the info to an element component and you get this:
but as you can see, it doesn't show payment options or the subscription amount or anything
but this is working, I can finish payment and see it in my dashboard as a subscription
but it doesn't show what we want
Element is just for accepting payments, you need to diplay the amount and cart and any other informaion by your own
but what about the payment options?
isn't there supposed to be some card with some different options available to pick from? we have loads activated
this thing never shows:
just a sec
the php or the vue3?
Here is the onMount() in the component:
onMounted(async () => {
stripe = await loadStripe(`${process.env.VUE_APP_STRIPE_PUBLISHABLE_KEY}`);
try {
const data = await playerSubscription(props.subscriptionArgs);
clientSecret.value = data.latest_invoice.payment_intent.client_secret;
messages.value.push("お支払い情報を入力してください。");
const appearance = {
theme: 'flat',
variables: { colorPrimaryText: '#68E5AE' },
}
const options = {
layout: {
type: 'tabs',
defaultCollapsed: false,
}
};
const elements = stripe.elements({ clientSecret: clientSecret.value, appearance });
const paymentElement = elements.create('payment', options);
paymentElement.mount("#payment-element");
const linkAuthenticationElement = elements.create("linkAuthentication");
linkAuthenticationElement.mount("#link-authentication-element");
isLoading.value = false;
} catch (e: any) {
console.error("ペイメント・インテントの作成中に問題が発生しました: ", e);
messages.value.push("ペイメント・インテントの作成中に問題が発生しました。");
}
});
The payment intent that you are using, could you pleaase share it's Id
And the php:
public function makeSubscription(Request $request){
try{
$uniid=$request->player_unique_key;
$playerid=Player::where('unique_key','=',$uniid)->first();
if($playerid){
$stripe = new \Stripe\StripeClient(env('STRIPE_SECRET'));
$priceobj=$request->price_obj;
$priceid="";
if(UtalityController::isJson($priceobj)){
$json = json_decode($priceobj, true);
$priceid=$json['id'];
}else{
$priceid=$priceobj;
}
$customer=$playerid->createOrGetStripeCustomer();
$customerid= $customer->id;
$sub=$stripe->subscriptions->create([
'customer' => $customerid,
'items' => [['price' => $priceid]],
'payment_behavior' => 'default_incomplete',
'payment_settings' => ['save_default_payment_method' => 'on_subscription'],
'expand' => ['latest_invoice.payment_intent'],
]);
return UtalityController::api_send(200,$sub);
}else{
return UtalityController::api_send(200,"StripeRepository makeSubscription: No Player Found");
}
}catch(Exception $ex){
return UtalityController::error_send($ex->getMessage());
}
}
data.latest_invoice.payment_intent
oh
just a sec
pi_3NcnibJaqukygSBJ1oLnPZwb
that's the latest one that just got made
did that help you figure out the issue?
thanks for sharing, checking..
What you can do is to specify what other payment methods you wan to accept with the subscriptions:
https://stripe.com/docs/api/subscriptions/create#create_subscription-payment_settings-payment_method_types
by default only card are used
i thought we could set that up in the dashboard and it would propogate down or something
is that not true?
that's when using automatic payment_methods with elements
Okay! Do you have a quick example of this payment settings payment method types enum?
You have them in the documentations reference I shared with you.
Not really, it doesn't have examples.
Would it look like this?
const options = {
layout: {
type: 'tabs',
defaultCollapsed: false,
},
payment_settings: {
payment_method_options: {
card: true,
konbini: true,
}
},
};
Not really, it doesn't have examples.
Here are all the available enums:
https://stripe.com/docs/api/subscriptions/create#create_subscription-payment_settings-payment_method_types
payment_method_types: ["card","...]
I do see that, thank you. Sorry for being bothersome, but what does it actually look like when I add it to the options object? Do i need to specify it is part of payment_settings? or just payment_method_types: ["card","...]
const options = {
layout: {
type: 'tabs',
defaultCollapsed: false,
},
payment_settings: {
payment_method_options: ["card", '...],
},
};
Like this?
Wait, that code is your frontend,
you need to add payment_method_types: ["card",...] when creating the Susbcription
in your php code
ahhh, I see
$sub=$stripe->subscriptions->create([
'customer' => $customerid,
'items' => [['price' => $priceid]],
'payment_behavior' => 'default_incomplete',
'payment_settings' => ['save_default_payment_method' => 'on_subscription'],
'pyament_settings' => ['payment_method_options' => ['card', '...]],
'expand' => ['latest_invoice.payment_intent'],
]);
would that work? or does it need to be all in one line with the 'save_default_payment_method'?
Thanks for all you help! I'll try to figure it out from here!