#koks_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1296099433460531231
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- koks_api, 5 days ago, 32 messages
hi
Hello
Is there a guide you're following for this?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
refering this link
What error are you seeing?
I'm not getting any error, rather i get a link and i open it to make payment . I want to use the saved card details but i see all blank card values
how can i retrieve saved card details for returning customer?
We explain when a checkout session prefills the payment method details here: https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-customer
do i need to enable payment_intent_data.setup_future_usage to prefill the card details for returning customer?
You should.. This would allow you to save payment method if the customer doesn't have one saved already
let me try
payment_intent_data.setup_future_usageis unsupported for payment methodklarna`
getting this error
The error is correct. You can't save klarna type payment method.
Sorry help you with what exactly?
To be clear, we have complete guides for the flow you're trying to integrate: https://docs.stripe.com/payments/save-during-payment?platform=web&ui=stripe-hosted
I'd recommend giving that a read to make sure you haven't missed anything
I just read the document and i see i have all the paramters as mentioned
String second = string.valueOf(system.now().second())+(300);
body += 'success_url='+ siteURL +'?opportunity_id='+OpportunityId;
body += '&cancel_url='+ siteURL + '?session_id={CHECKOUT_SESSION_ID}';
body += '&line_items[0][price_data][product]=' + product_Id;
body += '&line_items[0][price_data][unit_amount]=' + amt;
body += '&line_items[0][quantity]=1';
body += '&line_items[0][price_data][currency]=' + crncy;
body += '&mode=payment';
body += '&customer_creation=always';
body += '&saved_payment_method_options[payment_method_save]=enabled';
body += '&saved_payment_method_options[allow_redisplay_filters]';
body += '&payment_intent_data[setup_future_usage]=on_session';
if(PaymentMethodType=='card'){
body += '&payment_method_types[0]=card';
} else {
body += '&payment_method_types[0]=card';
body += '&payment_method_types[1]=us_bank_account';
body += '&payment_method_types[2]=cashapp';
body += '&payment_method_types[3]=klarna';
}
body += '&tax_id_collection[enabled]=true';
body += '&client_reference_id=' + customerId;
// body += '&customer=' + customerId;
body += '&billing_address_collection=required';
body += '&phone_number_collection[enabled]=true';
Do i need this " body += '&payment_intent_data[setup_future_usage]=on_session';" for saving card details with Mode = Payment?
This section explains it - https://docs.stripe.com/payments/save-during-payment?platform=web&ui=stripe-hosted#save-payment-methods-to-prefill-them-in-checkout
If you're only trying to save the payment method to prefill it then you don't need setup_future_usage.
If you're trying to save the payment method to charge it later when the customer isn't around then you should set setup_future_usage
Since you're setting payment method types yourself in your code, i.e.
body += '&payment_method_types[0]=card';
} else {
body += '&payment_method_types[0]=card';
body += '&payment_method_types[1]=us_bank_account';
body += '&payment_method_types[2]=cashapp';
body += '&payment_method_types[3]=klarna';
}```
You'll get the API error as you're setting `setup_future_usage` while using `klarna` as a payment method. So either remove `setup_future_usage` or `klarna`
OR if you want to keep both, you can specify `setup_future_usage` for just cards under `payment_method_options.card.setup_future_usage` ( and remove top level `payment_intent_data[setup_future_usage]`)
https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-payment_method_options-card-setup_future_usage
I don't need to charge customer later when they aren't around
then you can omit setup_future_usage altogether
so i'll remove setup_future_usage and try now
If you're trying to save the payment method to charge it later when the customer isn't around then you should set setup_future_usage
how can I test this scenario
can you guide me?
Would recommend reading this section in the doc - https://docs.stripe.com/payments/save-and-reuse?platform=web&ui=stripe-hosted#charge-saved-payment-method
Hi there ๐ catching up as my teammate needs to step away soon. Am I right in understanding that you're trying to get details of Customer's existing Payment Method to be prefilled in a Checkout Session?
If so, what I typically see preventing that, is that the Payment Method is created without full billing details like an address. Can you share the ID of the Payment Method (has a pm_ prefix) that you're wanting to be prefilled in checkout?
hi
you are right
i want to understand once card details are saved, how can i re use it pay when customer isn't around
exactly trying to save the payment method to charge it later when the customer isn't around
Okay, let's start by making sure I understand what you're trying to accomplish, because it seems like those are conflicting answers.
Are you:
A) trying to save a Payment Method so you can use it to charge customers later when they aren't around
or
B) trying to save a Payment Method in such a way that when your customer sees their saved Payment Method details prefilled when they access a Checkout Session later
want to automatically deduct the remaining amount by using saved card details
option A is what i am looking for
Gotcha, and you are trying to save those details while also processing a payment?
Like you're charging the customer a first payment immediately, and then plan to charge their Payment Method for the remaining amount later?
right
Gotcha, to do that, you will need to set payment_intent_data.setup_future_usage to off_session when creating the Checkout Session.
If you're manually passing your own values for payment_method_types (rather than using dynamic payment methods), then you will need to override that value on a per-payment-method basis to ensure you aren't trying something that isn't supported.
So if you specify klarna in payment_method_types, then you also need to set payment_method_options.klarna.setup_future_usage to none. You'll also need to have business logic and code ready to handle that, since if your customer chooses to pay with Klarna you won't be able to charge that Payment Method again in the future.
so are you saying, klarna payment method types are not supported for future payments?