#koks_api

1 messages ยท Page 1 of 1 (latest)

spare chasmBOT
#

๐Ÿ‘‹ 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/1293927207076368505

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

novel wagon
#

Hello

#

What's the question here?

sand light
#

Hi, I'm getting this error while making stripe API call

#

You may only specify one of these parameters: customer, customer_creation

novel wagon
#

Yep

#

As the error states, you would only use one of those parameters

#

Can you explain what you are trying to do / the confusion here?

sand light
#

sure

#

I want to save customer payment details while making payment so i used this option "saved_payment_method_options.payment_method_save"

#

for this option to use i need use customer attribute which is a must attribute in api

#

so i gave a value to it and got an error saying customer not available

#

so i added additional attribute as "customer_creation = always"

#

getting this error as "You may only specify one of these parameters: customer, customer_creation"

novel wagon
#

so i gave a value to it and got an error saying customer not available
When you say that you mean you created a Customer object ahead of your Session creation and passed that Customer ID to customer when creating your Checkout Session?

sand light
#

no i didnt create customer object ahead...i use single api call only

novel wagon
#

Okay this should work fine if you just remove the customer parameter

#

You just can't use both of those

#

Are you using a payment or subscription mode Checkout Session here?

sand light
#

payment

#

this is sample body which i send via api

#

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';
// Set customer_creation to always
body += '&customer_creation=always';
// Enable saved payment method options
body += '&saved_payment_method_options[payment_method_save]=enabled';

    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';
novel wagon
#

Yeah just omit customer there if you don't want to pass in a previously created Customer

#

Otherwise, if you are doing that, then remove customer_creation

sand light
#

let me try that

#

and update you in a min

novel wagon
#

Sure

sand light
#

you are awesome, it worked! thank you

novel wagon
#

๐ŸŽ‰

sand light
#

can you share me test card number