#koks_checkout-customer

1 messages ¡ Page 1 of 1 (latest)

wide fieldBOT
#

👋 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/1298657168563769386

📝 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.

fathom chasm
#

Hello can you send me the line of code where you create this checkout session?

#

It sounds like you may need to set customer_creation to always

static niche
#

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 += '&consent_collection[terms_of_service]=required';
body += '&custom_text[terms_of_service_acceptance][message]=I authorize Joseph L. Balkan Inc. to store my card details for future payments in accordance with their link';
body += '&payment_intent_data[setup_future_usage]=off_session';
body += '&payment_method_options[klarna][setup_future_usage]=none';

    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';
    body += '&customer_email=' + UserInfo.getUserEmail();
#

this is what i use

fathom chasm
#

Interesting I do see that that says customer creation always. Can you send me the ID of a checkout session that you created with that code that completed without creating a customer? (cs_test_1234)

static niche
#

cs_test_a1UkMcFJLe9rr0KWljlehV7OaxW0lca6BEmMGMaTu4XDNGAk6ucywmT7Fe

#

is this what you are asking for?

fathom chasm
#

Yes that is exactly it. Thank you

#

Oh actually that Checkout Session hasn't been completed yet. Have you been completing the payment process on these checkout sessions? I think the customer isn't created until the session completes

static niche
#

its in test so i didn't complete it

#

if i complete the test payment it gets created is it?

fathom chasm
#

Yep yep, that should work

static niche
#

I had completed test payment now. do you see customer created now?

fathom chasm
#

No, but I do see that that specific Checkout Session has customer_creation='if_required'

static niche
#

do i need to enable this attribute...currently i had commented it out?

fathom chasm
#

Yes, uncomment it. You do want customer_creation to be set to always here

static niche
#

for an existing customer if i initiate a payment...does this attribute need to be included as well?

fathom chasm
#

No, in that case you would include customer=cus_123 where cus_123 is the ID of the existing Customer that you want to reuse

static niche
#

would i get this customer Id as part of initial request where customer gets created? How can i get to know the cus_xxx Id?

fathom chasm
#

Checkout's customer creation waits until the checkout session completes, so the customer ID is not available as part of the original Checkout Session object there. If you want a customer ID from the start, you can create a Customer via a separate API call, record their ID, and then pass that ID in to the customer parameter when creating your checkout session

static niche
#

ah i see...understood. I can explore it

#

I had completed test payment, do you see customer created now?

#

i had included customer_creation attribute now

fathom chasm
#

If you retrieve the checkout session by its ID you can check if the customer field is filled out

static niche
#

sure, i can check. Did it create customer record now?

fathom chasm
#

If you send me the checkout session ID, I can look, but you retrieving the checkout session by its ID would likely be just as easy

static niche
#

cs_test_a1UGoJq4cRBVh9sxRXwfNiZ4OAfnOhV0Wip2QUweAvKEaHdwlcGGsRtyBY

#

sorry...refer this session id --> cs_test_a19ado2M6WpI5seYX6GSx4nbjeQnf79gZZvM85teJI1Ta2dYDI67ZwKZ4c

#

this is where i completed the payment

#

I see 404 not found

fathom chasm
#

I do see customers on those sessions. It looks like the 404 is happening because you are trying to retrieve the checkout session from a different account than the one that created it

#

Can you double check to make sure you are using the same secret key for the retrieve as you did for the creation?

static niche
#

are these customers created for prod secret key or test secret key?

fathom chasm
#

They are created in the mode that they were created in on the account that they were created in. Here you are creating and retrieving the checkout sessions in test mode, but the create and retrieve are on different accounts

static niche
#

got it, I could see the response now

#

how can i get payment method id here?

fathom chasm
#

That will be assosciated with the payment intent on the checkout session. You can either retrieve the payment intent separately or you can expand the payment_intent field when retrieving the checkout session

static niche
#

ok, let me check

#

is this the one i need to use?

wide fieldBOT
devout surge
#

koks_checkout-customer

static niche
#

sure

#

I have done a test payment intent where i want to initiate payment automatically for saved card and deducted 250USD....this is pi reference # pi_3QD76VKgdHKl58fj0UCOhu48

#

can you check and confirm if this has been done correctly?