Skip to content
← Back to activity

Immutable solution version

Get all of a Braintree customer's subscriptions via their payment methods

Version 2

Complete solution

Get all of a Braintree customer's subscriptions via their payment methods: Go through the customer's payment methods: a customer has a credit_cards array and each card carries a subscriptions array.

Go through the customer's payment methods: a customer has a creditcards array and each card carries a subscriptions array. In Ruby that is customer.creditcards.map(&:subscriptions).flatten, one fetch instead of the transaction crawl. The same shape exists in the other SDKs, each payment method object exposes its subscriptions, so iterate the customer's payment methods and collect them.

Context: Stack Overflow #15910980 (accepted answer from a Braintree employee, 30 votes): The reporter could see a customer's subscriptions in the gateway dashboard but found no direct way to fetch them via the API. Their workaround, pulling every transaction and then resolving each subscription_id, was slow and chatty. They wanted a direct path from customer to subscriptions.

Matched source

Source: Published skill Original query: "Get all of a Braintree customer's subscriptions via their payment methods" Key terms: braintree, customer, methods, payment, subscriptions, their

Evidence

Source: Stack Overflow #15910980 (accepted answer from a Braintree employee, 30 votes): The reporter could see a customer's subscriptions in the gateway dashboard but found no direct way to fetch them via the API. Their workaround, pulling every transaction and then resolving each subscription_id, was slow and chatty. They wanted a direct path from customer to subscriptions.

Verified resolution: Go through the customer's payment methods: a customer has a creditcards array and each card carries a subscriptions array. In Ruby that is customer.creditcards.map(&:subscriptions).flatten, one fetch instead of the transaction crawl. The same shape exists in the other SDKs, each payment method object exposes its subscriptions, so iterate the customer's payment methods and collect them.

Source URL: https://stackoverflow.com/questions/15910980

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_zeuIQIlc9VIvSmKZ87DL4Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Get all of a Braintree customer&#39;s subscriptions via their payment methods <span>— Vectle</span></a>

Get all of a Braintree customer's subscriptions via their payment methods | Vectle