#pillow-fun_code

1 messages ยท Page 1 of 1 (latest)

warped jungleBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1255005899693621298

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

last hawk
boreal girder
#

request
{
"key": "pk_live_*********************************qBtPSt",
"type": "payment_intent",
"client_secret": "
",
"stripe_js_id": "a6eec092-ed77-4841-a9be-d831dc652328",
"referrer_host": "ghost-thorough-pegasus.ngrok-free.app",
"locale": "zh-CN",
"_stripe_account": "acct_1PU16SCnVROFWTKC",
"expand": {
"0": "payment_method_preference.payment_intent.payment_method"
}
}

response

{
"error": {
"message": "The client_secret provided does not match any associated PaymentIntent on this account. Ensure the publishable key used belongs to the same account that created the PaymentIntent.",
"param": "client_secret",
"request_log_url": "https://dashboard.stripe.com/acct_1PU16SCnVROFWTKC/logs/req_8n4nlGyr7cY8s0?t=1719285788",
"type": "invalid_request_error"
}
}

#

GET /v1/elements/sessions

last hawk
#

On your server side, how are you creating the PaymentIntent?

boreal girder
#

$stripe = new \Stripe\StripeClient($this->payconfig['api_key']);$paymentIntent = $stripe->paymentIntents->create(
[
'amount' => 1099,
'currency' => 'usd',

        'automatic_payment_methods' => ['enabled' => true],
      ]
    );

    $data['client_secret'] = $paymentIntent->client_secret;
    $error = '';
    $data['public_key'] = $this->payconfig['public_key'];
    $data['error'] = $error;
    $data['data_paymentIntent_express_faild'] = $paymentIntent;
    $data['connected_account_id'] = $this->payconfig['connected_account_id'];
#

the 'data' is the 'json', on above js script

last hawk
#

Can you share the request id for when you created the intent for the above example?

boreal girder
#

wait a moment

last hawk
#

sure

boreal girder
#

{
"automatic_payment_methods": {
"enabled": "true"
},
"currency": "usd",
"amount": "1099"
}

{
"id": "pi_3PVQa7CnVROFWTKC092zGrsx",
"object": "payment_intent",
"amount": 1099,
"amount_capturable": 0,
"amount_details": {
"tip": {
}
},
"amount_received": 0,
"application": "ca_POxDdW8GXU0yvr8Fis61TaCNPlhpw9OP",
"application_fee_amount": null,
"automatic_payment_methods": {
"allow_redirects": "always",
"enabled": true
},
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "automatic_async",
"client_secret": "pi_3P*************************************************dvSi",
"confirmation_method": "automatic",
"created": 1719288131,
"currency": "usd",
"customer": null,
"description": null,
"invoice": null,
"last_payment_error": null,
"latest_charge": null,
"livemode": true,
"metadata": {
},
"next_action": null,
"on_behalf_of": null,
"payment_method": null,
"payment_method_configuration_details": {
"id": "pmc_1PU1lDCnVROFWTKCChyusvGk",
"parent": "pmc_1PI4KlGYwkaB6J4B08gDHcLm"
},
"payment_method_options": {
"card": {
"installments": null,
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
}
},
"payment_method_types": [
"card"
],
"processing": null,
"receipt_email": null,
"review": null,
"setup_future_usage": null,
"shipping": null,
"source": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "requires_payment_method",
"transfer_data": null,
"transfer_group": null
}

#

i got the right session now

#

but i can't see the EXPRESS BUTTON

last hawk
#

What do you mean by 'EXPRESS BUTTON'?

silent sapphireBOT
noble sky
#

Hi @boreal girder I'm taking over, let me know if you have any follow-up questions.

boreal girder
#

the EXPRESS BUTTON is not found

noble sky
#

Is it about ExpressCheckouElement?

boreal girder
#

yes

#

const stripe = Stripe(json.public_key , {
stripeAccount: json.connected_account_id
});
const elements_options = {
clientSecret: json.client_secret
};
const elements = stripe.elements(elements_options);
const expressCheckoutElement = elements.create('expressCheckout', {})
expressCheckoutElement.mount('#express-checkout-element')

noble sky
#

Ok, I do see the ExpressCheckoutElement displayed in the screenshot.

#

So what buttons are you looking for? google pay button ?

boreal girder
#

but the "express-checkout-element" dom is empty

#

i am looking for the "Link" button

noble sky
#

OK, do you see any errors in the browser console?

boreal girder
#

no error on console

noble sky
#

Ok, looks like you didn't specify options to elements

boreal girder
#

like this ?

const elements = stripe.elements(elements_options);
const options = {
paymentMethods:{
applePay:'always',
link:'auto',
paypal:'auto',
}
};
const expressCheckoutElement = elements.create('expressCheckout', options)
expressCheckoutElement.mount('#express-checkout-element')

noble sky
boreal girder
#

Invalid options for elements(): Expected either mode or clientSecret, but not both

#

i pass the clientSecret

#

when i use mode replace the clientSecret, I got the same result

noble sky
#

Remove clientSecret and try again

boreal girder
#

const elements_options = {
mode: 'payment',
amount: 1099,
currency: 'usd',
// clientSecret: json.client_secret
};
const elements = stripe.elements(elements_options);
const options = {
paymentMethods:{
applePay:'always',
link:'auto',
paypal:'auto',
}
};
const expressCheckoutElement = elements.create('expressCheckout', options)
expressCheckoutElement.mount('#express-checkout-element')

#

still empty

#

When I use public key in my own account, it is ok, like this :

const stripe = Stripe('pk_live_51PU16SCnVROFWTKCB2PWmWBhychOK6Q5AxBwRzNp82Ath4UEQPJRRs0yziXZhsKnBpt7dFJnvpGkqJQvQYFYaQhq00g6v1cfMD' );
const elements_options = {
mode: 'payment',
amount: 1099,
currency: 'usd',
};
const elements = stripe.elements(elements_options);
const options = {
paymentMethods:{
applePay:'always',
link:'auto',
paypal:'auto',
}
};

#

When I use connected Acount like this, the dom is empty

const stripe = Stripe(json.public_key , {
stripeAccount: json.connected_account_id
});

#

I'm going to take a nap soon, and I'll continue with you later

noble sky
#

What's the connected account ID?

boreal girder
#

I'm back

#

connected_account_id: acct_1PU16SCnVROFWTKC

noble sky
#

OK, have you registered payment method domain for this connected account?

boreal girder
#

wait an moment

#

ๅŸŸๅ
ghost-thorough-pegasus.ngrok-free.app
โ€‹
ๅŸŸๅ ID
pmd_1PU6cPCnVROFWTKC7MzEdPPE

last hawk
#

Do you have any css sizing restictions? Can you share the firect URL so I can debug this fruther on my end?

boreal girder
#

wait an moment

#

Can you debug this Url ?

noble sky
#

Let me take a look

boreal girder
#

Is there any configuration that hasn't been enabled

noble sky
#
    stripeAccount: json.connected_account_id
});```

is this public_key the platform's publishable key ?
boreal girder
#

yes

#

initialize();
function initialize() {
$.ajax({
url: "/index/payment/fast_strip/initEmbeddedCheckout",
data:{ },
method:"POST",
dataType: 'json',
success: function (json) {

                console.log('data_paymentIntent_payment_ok')

                console.log(json.public_key)
                console.log(json.connected_account_id)
                console.log(json.data_paymentIntent_payment_ok)

const stripe = Stripe(json.public_key, {
stripeAccount: json.connected_account_id,
});
const options = {
clientSecret: json.client_secret_embedded,
appearance: {},
};
$('#payment-form').show();
const elements = stripe.elements(options);

const paymentElement = elements.create('payment');
paymentElement.mount('#payment_content_stripe');

            },
            error: function (xhr, ajaxOptions, thrownError) {
                alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
            }
        } );

    }
noble sky
#

I saw Apple Pay in Safari

boreal girder
#

oh~

noble sky
#

Hmm, so are you using payment element or express checkout element?

#

The code snippet that you just shared is about payment element

boreal girder
#

express checkout element

#

The payment element is not a problem, so I believe this platform's publishable keyis correct

noble sky
#

Can you try this?

    paymentMethods:{
        applePay:'always',
        link:'always',
        paypal:'always',
    }
};```
boreal girder
#

ok I will try

#

I can't set "always"

#

I'll be out for a few minutes, I'll contact you later

noble sky
#

Then set paypal to auto

boreal girder
#

I can only configure it this way:
const options = {
paymentMethods:{
applePay:'always',
link:'auto',
paypal:'auto',
}
};

#

I'll be out for a few minutes, I'll contact you later

#

I can't set link & paypal as always

noble sky
#

Ok. I still trying to figure out why LInk doesn't show in the connected account.

#

Can you double check if the connected account ID is indeed acct_1PU16SCnVROFWTKC ?

boreal girder
#

I'll check

#

The sub account is correct: acct_1PU16SCnVROFWTKC

noble sky
#

Ok I found the problem

boreal girder
#

I am connect platform to review this

#

wow ~, It's ok now

#

Thank you for your professional guidance