Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Charge Source #1384

Closed
jmawebtech opened this issue Nov 9, 2018 · 2 comments · Fixed by #1385
Closed

Charge Source #1384

jmawebtech opened this issue Nov 9, 2018 · 2 comments · Fixed by #1385

Comments

@jmawebtech
Copy link

jmawebtech commented Nov 9, 2018

Hi,

With some charges, they have a source of ACH debit. These charges must be queried using the source field. How do I query by source using the ChargeService? Here is the URL that I would use:

string url = String.Format("{0}/v1/charges?created%5Bgte%5D={1}&created%5Blte%5D={2}&limit=100&expand[]=data.invoice&expand[]=data.customer&offset={3}", m_BaseUrl, ConvertToTimestamp(beginTime), ConvertToTimestamp(endTime), i * 100);

if (!String.IsNullOrEmpty(source))
    url += "&source[object]=" + source;
@ob-stripe
Copy link
Contributor

Hi @jmawebtech. Right now, the ChargeListOptions class is lacking the Source attribute, but I'm going to push a fix that will allow you to do something like this:

var chargeService = new ChargeService();
var listOptions = new ChargeListOptions
{
    Created = new DateRangeOptions
    {
        GreatherThanOrEqual = beginTime,
        LessThanOrEqual = endTime,
    },
};
if (!String.IsNullOrEmpty(source))
{
    listOptions.Source = new ChargeSourceListOptions
    {
        Object = source,
    };
}
listOptions.AddExpand("data.invoice");
listOptions.AddExpand("data.customer");

var charges = chargeService.List(listOptions);

@ob-stripe
Copy link
Contributor

This is fixed as of version 21.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants