Jacob Vermeule
Jacob Vermeule

Reputation: 11

GET custom_fields.text.value from Stripe API in Azure Logic Apps

I am trying to make a get request to the Stripe API that gets a user based on the custom value that is entered by the customer. The query now returns all users but I want just 1 user. E.g. how would I get the user where the custom value is "Jacob". I tried some examples following the search query language as described in the Stripe API documentation but I can't figure it out. Do you have any ideas/suggestions? Thanks!

I tried a lot of queries but they all respond with a list of all the users. I tried for example the following:

https://api.stripe.com/v1/checkout/sessions?custom_fields.text.value:"Jacob"

https://api.stripe.com/v1/checkout/sessions

The response is always with multiple users like this:

{ "object": "list", "data": [ { "id": "cs_test_a1s5jKQSuTRk5P3FfsHMQCUrDVBqxPLeinAKA9lvTtZsDMNRuGXlDRNdWN", "object": "checkout.session", "after_expiration": null, "allow_promotion_codes": false, "amount_subtotal": 500, "amount_total": 500, "automatic_tax": { "enabled": true, "status": "complete" }, "billing_address_collection": "auto", "cancel_url": "https://stripe.com", "client_reference_id": null, "consent": null, "consent_collection": { "promotions": "none", "terms_of_service": "none" }, "created": 1696582486, "currency": "eur", "currency_conversion": null, "custom_fields": [ { "dropdown": null, "key": "deviceid", "label": { "custom": "Device ID", "type": "custom" }, "numeric": null, "optional": false, "text": { "maximum_length": null, "minimum_length": null, "value": "Stijn" }, "type": "text" } ], "custom_text": { "shipping_address": null, "submit": null, "terms_of_service_acceptance": null }, "customer": "cus_OlhDRNITdeHGlj", "customer_creation": "if_required", "customer_details": { "address": { "city": null, "country": "NL", "line1": null, "line2": null, "postal_code": null, "state": null }, "email": "[email protected]", "name": "S. Surname", "phone": null, "tax_exempt": "none", "tax_ids": [] }, "customer_email": null, "expires_at": 1696668886, "invoice": "in_1Ny9ouFb8QkNpja8gRjnp121", "invoice_creation": null, "livemode": false, "locale": "auto", "metadata": {}, "mode": "subscription", "payment_intent": null, "payment_link": "plink_1Ny8K4Fb8QkNpja8UHnkSH1t", "payment_method_collection": "always", "payment_method_configuration_details": null, "payment_method_options": null, "payment_method_types": [ "card" ], "payment_status": "paid", "phone_number_collection": { "enabled": false }, "recovered_from": null, "setup_intent": null, "shipping_address_collection": null, "shipping_cost": null, "shipping_details": null, "shipping_options": [], "status": "complete", "submit_type": "auto", "subscription": "sub_1Ny9ouFb8QkNpja8RhV7sv0i", "success_url": "https://stripe.com", "total_details": { "amount_discount": 0, "amount_shipping": 0, "amount_tax": 0 }, "url": null }, { "id": "cs_test_a19WInedGT86yB3x0J09RVNoCTrYwVa6ue9otLUaaICIK0UVciVOkt8J1X", "object": "checkout.session", "after_expiration": null, "allow_promotion_codes": false, "amount_subtotal": 500, "amount_total": 500, "automatic_tax": { "enabled": true, "status": "complete" }, "billing_address_collection": "auto", "cancel_url": "https://stripe.com", "client_reference_id": null, "consent": null, "consent_collection": { "promotions": "none", "terms_of_service": "none" }, "created": 1696576812, "currency": "eur", "currency_conversion": null, "custom_fields": [ { "dropdown": null, "key": "deviceid", "label": { "custom": "Device ID", "type": "custom" }, "numeric": null, "optional": false, "text": { "maximum_length": null, "minimum_length": null, "value": "Jacob" }, "type": "text" } ], "custom_text": { "shipping_address": null, "submit": null, "terms_of_service_acceptance": null }, "customer": "cus_OlfgQ8SHoECHPJ", "customer_creation": "if_required", "customer_details": { "address": { "city": null, "country": "NL", "line1": null, "line2": null, "postal_code": null, "state": null }, "email": "[email protected]", "name": "myName", "phone": null, "tax_exempt": "none", "tax_ids": [] }, "customer_email": null, "expires_at": 1696663212, "invoice": "in_1Ny8KyFb8QkNpja8w1o1hiKC", "invoice_creation": null, "livemode": false, "locale": "en", "metadata": {}, "mode": "subscription", "payment_intent": null, "payment_link": "plink_1Ny8K4Fb8QkNpja8UHnkSH1t", "payment_method_collection": "always", "payment_method_configuration_details": null, "payment_method_options": null, "payment_method_types": [ "card" ], "payment_status": "paid", "phone_number_collection": { "enabled": false }, "recovered_from": null, "setup_intent": null, "shipping_address_collection": null, "shipping_cost": null, "shipping_details": null, "shipping_options": [], "status": "complete", "submit_type": "auto", "subscription": "sub_1Ny8KyFb8QkNpja8DqEFdCWt", "success_url": "https://stripe.com", "total_details": { "amount_discount": 0, "amount_shipping": 0, "amount_tax": 0 }, "url": null } ], "has_more": false, "url": "/v1/checkout/sessions" }

Upvotes: 0

Views: 145

Answers (1)

Jacob Vermeule
Jacob Vermeule

Reputation: 11

I have a little workaround for my problem. I now get the Stripe user ID whenever a charge is added and save the ID on Azure. Then in the Logic App I check which ID corresponds with the user ID and perform the get request for the checkout list based on this ID. It is not that elegant perhaps (and maybe there is a better answer) but this works fine for now.

Upvotes: 0

Related Questions