#Vane-metadata
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
what do you mean by order? are you talking about the Orders API?https://stripe.com/docs/api/orders_v2
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I stored order-id's in the metadata
in the metadata of what?
so I want to like retrieve a paymentintent from its order id
I think I got it
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
isn't there a limit on that though?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
it's the search you're looking for
and there's an example there for how to retrieve PIs from metadata
ye thanks, what exactly are the \ \ \ \ ?
$stripe->paymentIntents->search([
'query' => 'status:\'succeeded\' AND metadata[\'order_id\']:\'6735\'',
]);
spaces?
\' is to escape the quotes
<b>Fatal error</b>: Uncaught (Status 400) (Request req_NSI9YD39EEjpCf) Search is not supported on api version 2018-11-08. Update your API version, or set the API Version of this request to 2020-08-27 or greater.
Oh yeah, you are on a very old API version
how would I update
but if you don't want to migrate all your code, you could specify the API version for this particular call
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
look at the Per-request Stripe version example
thanks ๐
can't seem to access 'id'
$stripe = new \Stripe\StripeClient(["api_key"=>'sk',"stripe_version" => "2020-08-27"]);
$paymentIntent = $stripe->paymentIntents->search([
'query' => 'status:\'succeeded\' AND metadata[\'order_id\']:\''.$order_id.'\'',
]);
echo $paymentIntent->data['id'];
I tried json_decode but that returns NULL
That's because data is an array
you'd need data[0]['id'] i believe
I'd print out what $paymentIntent looks like though to make sure it's actually returning results
yup its printing, yeah data[0]['id'] works