Search code examples
paypalpayment-gatewaybraintreecredit-cardbraintree-sandbox

search for active subscription for a customer in Braintree payments


In my website, I am using Braintree payment gateway for both card payments and PayPal transactions with auto renewal subscriptions.

i am creating the customer and storing the card in Braintree vault for auto renewal.. also using the same customer id for that customer PayPal transactions (if happened)

before proceeding the payment, just need to check for active subscription, for both auto renewable and auto renewal cancelled and still expiration date is due subscription existence.

  • is there any predefined methods for verifying that one with .net code?

I am new to payments, is there any recommended git projects available? so that it would helps a lot

thanks in advance.


Solution

  • It sounds like you want to find active subscriptions for a given customer. According to this answer, "customers have a credit_cards array, and each credit card has a subscriptions array."

    With that in mind, you can iterate through each credit card to grab each subscription. Once you have all the customer's subscriptions you can check their status. Here are the relevant Braintree Developer Docs links for .NET: