#abdullahergun_code

1 messages ยท Page 1 of 1 (latest)

night notchBOT
#

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

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

lean galleon
gleaming dove
#

yes

#

req_fP6NrbmrklPgaI

#

So I want to get the id of

"id":
"pi_3QhGw9BZ8dpn0pCV1dRHRmkL"

lean galleon
#

Taking a look

gleaming dove
#

Just so you know I am using wordpress/woocomerce

lean galleon
#

Yeah, we can't help if the issue is related to wordpress/woocomerce. However, I'm trying to see if I can help unblock you here.

#

Are you trying to attain the txn_ id from the response on the PaymentIntent creation? Is that right?

gleaming dove
#

Yes exctly

night notchBOT
dense otter
gleaming dove
#

In this request req_fP6NrbmrklPgaI

#

Response body contains
"id":
"pi_3QhGw9BZ8dpn0pCV1dRHRmkL"

#

I want to this id

#

This is in response object so should be easy to access

dense otter
#

What does your $order look like?

gleaming dove
#

function custom_action_on_pending_to_processing( $order_id ) {
// Do something when the order status changes from "pending" to "processing"
$order = wc_get_order( $order_id );
$TotalOrderValue = $order->get_total() ;
$PercentageToCharge = 50;
$calculated_percentage = calculate_percentage($TotalOrderValue, $PercentageToCharge );
$order->add_order_note(
'Order ID: ' . $order_id .
' Total : '. $order->get_total() .
' Currency : ' . $order->get_currency() .
' Payment Method Id '. $order->get_payment_method() .
' Payment Method Title ' . $order->get_payment_method_title() .
' Calculated percentage2 ' . $calculated_percentage .
' Transaction ID '. $order->get_transaction_id()

#

And this is where the charge is created

woeful sigil
#

๐Ÿ‘‹ Stepping in for my teammate, give me a few minutes to catch up

#

I removed your prior message since it contained a secret key (albeit a test mode secret key)

gleaming dove
#

Its a test one should not be an issue

woeful sigil
#

You mentioned you're trying to retrieve a PaymentIntent ID but the code you shared in your prior message is creating Charges.

#

In the code above, what does wc_get_order do? Do you have an example $order value?

gleaming dove
#

Intent and charges they both contains a unique 'id' field which is what I need

#

I can get order details such as

'Order ID: ' . $order_id .
' Total : '. $order->get_total() .
' Currency : ' . $order->get_currency() .
' Payment Method Id '. $order->get_payment_method() .
' Payment Method Title ' . $order->get_payment_method_title() .

#

Order is wordpress or id dont let it confuse you

#

I need to access the return object

woeful sigil
#

I'm still a little confused on what you're trying to do. Like you mentioned, Wordpress is creating the PaymentIntents on a connected account by calling the create PaymentIntents endpoint. How/where does your Charges code come in?

#

@gleaming dove let me know if you can provide more context