I can successfully pull an invoice object directly from the Stripe API but how do I modify the unique URL I'm using for the API narrow down the results to return only the data in one attribute/key?
Here's the Stripe API reference for "Retrieve An Invoice"
I'm pulling the entire object, but I want only the data from one key. For example, I the object includes the key and value: "currency": "usd"
, how can I search within the object for "currency" and return just the value "usd" (without quotes hopefully)?
I have a URL of the unique invoice which looks like: https://api.stripe.com/v1/invoices/in_xxxxxxxxxxxxxxxxxxxx
How can I modify this URL to narrow down the search results, to just pull the currency value of this specific invoice?
Stripe haven't implemented filtering (looking at their docs at least), so there's no way to filter the JSON using just the URL.
You'll need to write some code to extract the currency
property. Given that its a root level property that shouldn't be hard at all.
var obj = JSON.parse(// get object);
if (obj) {
var currency = obj.currency;
// do whatever with it here
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.