#andreas-checoutsession-py_

1 messages ยท Page 1 of 1 (latest)

low finchBOT
tame rover
#

py charge objects when using any other payment method
That's not true at all

#

Where did you hear that

noble ether
#

stripe support online chat

tame rover
#

AFAIK that's not true

#

Could be wrong

#

However, you should be using Payment Intents not Charges

#

Charges are a legacy flow

#

Payment Intents are built on top of Charges, but have more functionality and are more powerful

noble ether
#

Yes I know I use payment intents

#

Chat from Chat started: 2024-01-02 18:28:58 UTC ...

#

(06:42:42 PM) Andreas T: so could you help me with my problem then?
(06:42:44 PM) Monica: Yes, while the channel is still close.
(06:42:53 PM) Monica: Sure, let me see what we can about it.
(06:43:04 PM) Monica: Could you please give me more information about the issue?
(06:43:18 PM) Monica: * what we can do
(06:43:28 PM) Andreas T: unified_payments (12).csv
(06:43:29 PM) Andreas T: When I run exports I get this
(06:44:03 PM) Monica: The file won't open on my end.
(06:44:10 PM) Monica: Could you please share it again?
(06:45:09 PM) Andreas T: you see I get some ids with py_ and some with ch_ which are both charges. What is the difference? Our book keeping department gets confused and want's clarification on that
(06:45:29 PM) Andreas T: unified_payments (12).csv
(06:46:43 PM) Andreas T: charges.csv
(06:47:08 PM) Monica: It still won't open but I get the idea. Thank you.
(06:48:21 PM) Monica: ch_ are for those that are created under charges. py_ is for those that are paid through bank or anything that is not paid under card method.
(06:48:32 PM) Andreas T: From what I'm seeing ch_ ids have a pm_ (card) attached while py_ charges do not
(06:48:52 PM) Monica: That is correct.

tame rover
#

Yeah my understanding is sometimes py_ is used and other times ch_ is used

#

But your code/integration should treat them the same

#

They're both charges

#

And if you're already using payment intents, you should be fine

noble ether
#

the problem is i need to debug this as py charges are not recorded by my system and I need to find out why

#

I try to treat them as the same

#

this is an export from the stripe portal py_ charges don't have card details

#

therefor I needd to treat them somewhat different

tame rover
#

You can still retrieve py_ id's via the retrieve a charge endpoint

#

From there you can look at the details

noble ether
#

this process is all done by a webhook event payment_intent.succeeded

tame rover
#

What's the issue?

#

If you're listening to payment_intent.succeeded you should have access to all the data there

#

I guess I don't understand the problem

#

There will be a payment method associated with the payment intent

noble ether
#

the problem is on my side "charge" goes into transaction table. ch_ land in the table and py_ does not

#

so I need to get a payment intent that has a py_... id in latest_charges property

#

in dev to see what's wrong

tame rover
#

Ah I see

#

I'm actually not completely familiar with when py vs ch is used

#

Let me check to see the easiest way to replicate this

#

AH so the support agent was right

#

I'm wrong

#

py is for all non-card objects

#

So you can just make a non-card payment in test mode to replicate

noble ether
#

that was my initial question how to do this

#

I only see "link" or cc details

#

when I use both of these I only get payment intents with ch_ charges

tame rover
#

You need to enable another payment method

noble ether
#

in the stripe portal?

tame rover
#

Yeah

#

Well depends how you create the checkout session

#

Are you using automatic payment methods?

noble ether
#

I think I have it locked down in code only to use "card" when I create the checkout session

#

But in production the business might allow others as well I don't know which takes precedence

#

Currently prod produces the py_ charges and I need to mimic that in dev

tame rover
#

Ok in test mode you just need to make a payment with any other payment method other than card

#

So if you already have other payment methods enabled on your dashboard, just pass one when creating the session

#

That's all you need to do

noble ether
#

ok so I have to enable other in the dashboard first right?

tame rover
#

Only if you haven't already

#

And you should be able to do it just for test mode

#

to not affect live mode settings

noble ether
#

just checking and there a lot on

tame rover
#

Ok so how do you create a checkout session

noble ether
#

that is dev

tame rover
#

Are you forcing only card

noble ether
#

I think so

tame rover
#

then that's your problem

noble ether
#

ok but same code base in prod how is it possible then to create payments that allow other methods there

tame rover
#

You haven't sent me a code snippet so I have no idea what you're doing still

#

How do you create a checkout session

noble ether
#

did not know that I can send you code

#

This is more complex might take a while

#

ok it look I don't restrict it just to 'card'

#

so that clarifies prod behaviour

#

I might have had in previous implementation

tame rover
#

Just send the code snippet for creating a session

#

Should only be a couple lines of code

#

I don't need everything

noble ether
#

that is creating the session try { $stripe_client_config = [ 'api_key' => $gateway->getSecretKey(), 'stripe_version' => self::STRIPE_API_VERSION, ]; $stripe = new StripeClient($stripe_client_config); $data = $session_data->toArray(); $session = $stripe->checkout->sessions->create($data); which does not help much

#

this 1$session_data = $this->buildSessionData($purchase_details, $order, $data); builds the data

tame rover
#

Yeah I need to see the params you're passing

noble ether
#

yeah I think I don't pass this prop right now.

#

so it should be determined by the setup in the dashboard right?

tame rover
#

yep

noble ether
#

can't find it

tame rover
#

just send me a request id then

#

a request id of you creating a checkout session in test mode

noble ether
#

"id": "cs_test_b1x2E59NmFTtnrF0915vem2KbJAwnhr7BXRVAAX5kudjAWtqf09YlemAuy"

#

is this what you need?

tame rover
#

That works

noble ether
#

it looks like I'm not sending the type

#

so it should be open

#

but the payment intent shows "payment_method_types": [ "card" ],

tame rover
#

You only have card, google pay, apple pay, and link enabled in your account

#

For acct_1NXSfYCffGirjBVI anyway

#

Which is what the session was created on

low finchBOT
noble ether
#

Shouldn't I see any of those then in dev mode as well when I do a test purchase

tame rover
#

card, google pay, apple pay, and link technically are all cards

noble ether
#

ok but they are not captured by you or are they?

#

however I can't see any other options on the interface

tame rover
#

That depends on your browser

#

google pay only shows in chrome if you're signed in to google and have a card added to wallet

#

apple pay same thing except safari

noble ether
#

yes on chrome

tame rover
#

In any case it's card

#

It won't generate py

#

LIke you want

noble ether
#

ok I only need py_

tame rover
#

enable any non card pm in your dashboard

noble ether
#

will do right now

final kayak
#

Hi ๐Ÿ‘‹

I'm stepping in and trying to catch up, give me a minute to read through while you test out using non-card payment methods

noble ether
#

ok

noble ether
#

enabled a couple more

final kayak
#

And just so I'm clear, currently you are simply trying to generate a non-card charge (py_) with a Checkout Session, correct?

noble ether
#

yes

#

so I can test why my webhook is not doing what it should

final kayak
#

That should be easily achieved using some non-card payment method (like us_bank_account or sepa_debit).

#

But you can also try mocking the payload response.

noble ether
#

don't see us_bank_account or sepa_debit options

final kayak
#

Okay, those other options would work as well

noble ether
#

will try alipay right now

#

ok payment went trough

#

let's see

#

payment_intent "id": "pi_3OXoQfCffGirjBVI1J5iyxlG",

#

ok is see "latest_charge": "py_3OXoQfCffGirjBVI1t6Yk9fo",

#

I guess that's all I needed. now I can start debugging

#

Thanks for your help

final kayak
#

Great ๐ŸŽ‰ I'm happy you were able to resolve the issue

noble ether
#

Ok thanks have a nice day

final kayak
#

You too