#hendr1x_api

1 messages ยท Page 1 of 1 (latest)

unborn fernBOT
#

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

๐Ÿ“ 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.

trail drift
#

Hello there

abstract cradle
#

howdy

trail drift
#

You wouldn't typically confirm a PaymentMethod using a SetupIntent if it has already been collected. Can you tell me more about what you are doing here?

abstract cradle
#

Do you have a few hours...haha

trail drift
#

lol hopefully you can give me the short version

abstract cradle
#

Alright so...earlier today I started adding subscriptions to my system. Flow goes...payment page, confirm page, click confirm->complete page. I found out that I couldn't attach the payment method to the subscription because I got the error "payment wasn't attached to customer" or something similar. This because the payment is generated on a different page, elements->createPaymentMethod. So, now for subscriptions I'm told I should pass the payment method in during confirmPayment(). Thats fine...I just coded that. I'd like to keep my system as simple as possible so I also converted my normal checkout (paymentIntent) to work the same way. Now I'm trying to do the setupIntent flow and I can't use a consistent apporach.

#

(nothing is tested for subscriptions yet)

trail drift
#

What do you mean by "the setupintent flow"?

abstract cradle
#

normal checkout (paymentIntent +setupIntent) is fully built

#

checkout flow where the customer is using setupIntent

trail drift
#

But you would just use confirmSetup() when collecting the PaymentMethod initially. So you wouldn't be passing in a PaymentMethod ID here.

abstract cradle
#

The system currently runs confirmPayment+confirmSetup when they click confirm on the confirm page

#

(not both - one or the other)

trail drift
abstract cradle
#

wait...I'm not doing that

trail drift
#

You can pass a PaymentMethod via that method if you are using separate steps here. But really you could also just confirm server-side.

abstract cradle
#

I'm not confirming serverside because I was told early on that handling payment processing requirements/customer feedback is much easier if we do it frontend

#

I should not be using any legacy approaches

#

I'm doing elements->createPaymentMethod

#

I'm just tying to make this as simple as possible

#

confirmSetup() does't seem to take payment_method

#

so I'm assuming I have to handle that differently....pass payment_method it when I create the setupItntent server side.

#

I just don't like have special rules if I can avoid it

trail drift
#

Okay wait

#

I think our JS Reference is simply incorrect.... have you tried passing payment_method here within confirmParams?

abstract cradle
#

I just add the code...have not run it

trail drift
#

I just tested and seems to work fine

abstract cradle
#

ok...so the docs are just missing that value?

trail drift
#

Yeah it appears so. Go ahead and test it out on your end too.

abstract cradle
#

You saw it had a payment_method_data

trail drift
#

But I'll flag internally that we are missing that parameter there

#

Ah actually

#

I know

#

The concept here is that you are supposed to use the confirmation_token parameter

#

Which is why we don't expose payment_method

#

As like I mentioned using createPaymentMethod is the legacy method

#

Replaced by createConfirmationToken()

abstract cradle
#

ah ok

#

yeah...so again..I discussed this with you guys

trail drift
#

But payment_method is also supported

abstract cradle
#

It seems like I can't use confirmationTokens if I want to use saved payment methods on accounts

#

So, if I wanted to use confirmationTokens I would have to add it AND have payment_methods for account saved payment methods AND track which is which....which is just more complexity than I really wanted to take on

#

I'm open to discussing of course

#

but I think I'm just gonna stick with payment_method

trail drift
#

Wait why can't you use confirmationTokens with saved payment methods?

#

Once you successfully confirm a Confirmation Token it results in a PaymentMethod.

abstract cradle
#

Right.

#

So I'm back to using payment_methods

#

As in...I can't use confirmationTokens alone

#

I would have to support both

trail drift
#

Hmm okay I suppose that is true. I think of these as two separate flows anyway so the only real difference is the object itself but up to you.

#

There is no intention I am aware of to deprecate createPaymentMethod() so you can go that route if you want. You would receive comms ahead of time in the future if that were ever to be deprecated.

abstract cradle
#

Figured.

#

Alright...thanks for hashing this through with me

#

I appreciate your patience. I will test payment_method and let you know if it doesn't work

trail drift
#

๐Ÿ‘

abstract cradle
#

I think you guys don't want me to open new threads right?

I have an error that I can't figure out

(php sdk)

system->subscriptions->create($intent, ['expand' => ['latest_invoice']]);

object(Stripe\Exception\InvalidArgumentException)#91 (7) { ["message":protected]=> string(44) "Got unexpected keys in options array: expand" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(66) "/var/www/core/vendor/stripe-php-17.2.0/lib/Util/RequestOptions.php" ["line":protected]=> int(174) ["trace":"Exception":private]=> array(10) { [0]=> array(5) { ["file"]=> string(66) "/var/www/core/vendor/stripe-php-17.2.0/lib/Util/RequestOptions.php" ["line"]=> int(70) ["function"]=> string(5) "parse" ["class"]=> string(26) "Stripe\Util\RequestOptions" ["type"]=> string(2) "::" } [1]=> array(5) { ["file"]=> string(63) "/var/www/core/vendor/stripe-php-17.2.0/lib/BaseStripeClient.php" ["line"]=> int(199) ["function"]=> string(5) "merge" ["class"]=> string(26) "Stripe\Util\RequestOptions" ["type"]=> string(2) "->" } [2]=> array(5) { ["file"]=> string(70) "/var/www/core/vendor/stripe-php-17.2.0/lib/Service/AbstractService.php" ["line"]=> int(75) ["function"]=> string(7) "request" ["class"]=> string(23) "Stripe\BaseStripeClient" ["type"]=> string(2) "->" } [3]=> array(5) { ["file"]=> string(74) "/var/www/core/vendor/stripe-php-17.2.0/lib/Service/SubscriptionService.php" ["line"]=> int(86) ["function"]=> string(7) "request" ["class"]=> string(30) "Stripe\Service\AbstractService" ["type"]=> string(2) "->" } [4]=> array(5) { ["file"]=> string(41) "/var/www/plugin/payment/system/stripe.php
nl0u312bqdj3oosdph3c6369nm )```
trail drift
#

No need to open a new thread if you already have one opened

#

Hmmm

#

Is system your stripe client initialization?

#

Or is this your own wrapping method?

abstract cradle
#

It is your stripe object / nothing between

trail drift
#

Okay and what is $intent?

abstract cradle
#
Array ( [customer] => cus_RMZxI2SLKKEHah [items] => Array ( [0] => Array ( [price] => price_1RKgGPCTw3MsNtCvNcV5422y ) ) [currency] => usd [payment_behavior] => default_incomplete [metadata] => Array ( [source] => subscription_plan_checkout [token] => JY6K5D7Z ) )
#

Its the subscription data

trail drift
#

Yeah okay expand needs to be within that array as well

#

See our example:

    $subscription = $stripe->subscriptions->create([
        'customer' => $customer_id,
        'items' => [[
            'price' => $price_id,
        ]],
        'payment_behavior' => 'default_incomplete',
        'payment_settings' => ['save_default_payment_method' => 'on_subscription'],
        'expand' => ['latest_invoice.confirmation_secret'],
    ]);
abstract cradle
#

ah ok

#

my bad

trail drift
#

All good