#just-ah_api

1 messages ยท Page 1 of 1 (latest)

placid bluffBOT
#

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

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

ruby sundial
#

What's the sub_xx ID you've created

#

My understanding is that PayPal should work in that scenario, so it's likely a integration misconfiguration

placid bluffBOT
kind fox
remote plume
#

hi! I'm taking over this thread.

#

so your goal is to pay a Subscription with Paypal and the Express Checkout Element?

kind fox
#

yes

#

and we use subscriptions with initial payment, without trial

remote plume
#

I tried setting off_session: true on the server when creating a subscription. In that case, the PayPal button appeared in the UI.
that's odd. give me a few minutes to try to reproduce this on my end.

kind fox
#

I can provide more code from server/client if needed

remote plume
#

can you share your frontend code, to see how you initilaize the ECE?

kind fox
#

sec

#

`
private createAdditionalPaymentButton(stripe: Stripe) {
const expressCheckoutElement = this.stripeElements?.create('expressCheckout', {
paymentMethods: {
applePay: 'always',
googlePay: 'always',
paypal: 'auto',
link: 'auto',
amazonPay: 'auto',
},
paymentMethodOrder: ['applePay', 'paypal', 'link', 'googlePay', 'amazonPay'],
buttonTheme: {
applePay: 'black',
googlePay: 'black',
paypal: 'gold',
},
layout: {
maxRows: 2,
},
buttonHeight: 48,
});

expressCheckoutElement?.mount(this.expressCheckoutContainer.nativeElement);
expressCheckoutElement?.on('click', (event) => {
  event.resolve({
    emailRequired: !this.email
  });
});

expressCheckoutElement?.on('ready', ({ availablePaymentMethods }) => {
  this.isExpressMethodsAvailable = !!availablePaymentMethods;
  this.isLoading = false; //TODO: make sure there is no better api in stripe to wai
});

expressCheckoutElement?.on('confirm', async (event) => {
  const { error } = await stripe.confirmPayment({
    elements: this.stripeElements,
    clientSecret: this.clientSecret,
    confirmParams: {
      return_url: `${location.origin}/result`,
    },
    redirect: 'if_required',
  });

  if (error) {
    this.handleError(error);
  } else {
    // Customer will be redirected to your `return_url`.
    this.goToSuccess();
  }
});

}`

remote plume
#

thanks, having a look

ruby sundial
#

Actually, ignore me. What does your stripe.elements() code look like?

kind fox
# ruby sundial Actually, ignore me. What does your `stripe.elements()` code look like?

` private createMainPayment(stripe: Stripe) {
this.stripeElements = stripe.elements({
clientSecret: this.clientSecret,
appearance: {
theme: 'stripe',
variables: {
borderRadius: '8px',
fontFamily: '"Open Sans", sans-serif;'
},
},
loader: 'always'
});

this.card = this.stripeElements?.create('card', {
  hidePostalCode: true,
  disableLink: true,
  style: {
    base: {
      lineHeight: '40px',
      fontFamily: '"Open Sans", sans-serif',
      fontSize: '16px',
    }
  }
});

this.card.mount(this.stripeElement.nativeElement);

if (!this.email) {
  this.stripeElements?.create('linkAuthentication').mount(this.stripeEmail.nativeElement);
}

}`

ruby sundial
#

And remove clientSecret

#

You have a mix of deferred and non-deferred integrations and I think it's messing with how we calculate which payment methods to display

kind fox
#

to give you a clue how our checkout form looks like here it is.

it contains payment by card option and one-click buttons

ruby sundial
#

Yes, we can account for that with separate Elements instances. Did you try what I outlined specifically for the ECE PayPal issue?

kind fox
# ruby sundial And remove `clientSecret`

Hm, I removed client secret, set mode = subscription + set amout and currency. And for some ready non of ECE one-click btns didn't appear.

it means that availablePaymentMethods is empty

ruby sundial
#

Well amount: 9 is below the minimum charge amount so I suspect that is the issue

#

It should accurately reflect the value of the intent โ€“ that value is passed to wallet UIs

#

Although that should not matter if mode: 'subscription' ๐Ÿค”

Is there anything in the dev console?

kind fox
#

I set amout = 150 and now one click button shown (but only LINK, not paypal)

ruby sundial
#

Is there somewhere I can reproduce this?

kind fox
ruby sundial
#

Hold on

kind fox
#

there are no any errors in console

ruby sundial
#

Which domain are you testing on?

kind fox
#

check this

just enter any random email and click next next, select productk and click checkout, this is sandbox

#

there is flow with clientSecret curretly deployed on that domain

placid bluffBOT
ruby sundial
#

Ah I think recurring PayPal payments in ECE are still in beta

kind fox
#

@remote plume did you find smth maybe? ๐Ÿ™‚

ruby sundial
#

Otherwise, I'd recommend spliting your ECE and Card Element integration up like I advised as it may cause issues down the line

kind fox
#

so I can request access to this beta feature?

ruby sundial
#

Specifically, have two separate Elements groups: one you initialise with the client secret for the Card Element the other with the other params for ECE

ruby sundial
kind fox
#

I'll try. Thank you so much guys for your help and time!

ruby sundial
#

We got there in the end

kind fox
#

one more quick question, what is the easiest way to add just a single paypal button? using any stripe js sdk/elements?

#

like I want to have ECE + single paypal button

mellow mirage
kind fox
mellow mirage
#

It should

kind fox
#

or..ynnoj ment that paypal reccuring payments in beta overall, but not only with ECE

mellow mirage
kind fox
#

got it, thanks for quick reply!