adebisi-fa / paystack-dotnet

PayStack API for .Net Developers!
http://developers.paystack.co/docs
MIT License
37 stars 37 forks source link

Enable callbackURL as a parameter on Transaction Initialize #18

Closed Adekoreday closed 4 years ago

Adekoreday commented 4 years ago

TransactionInitializeResponse Initialize(string email, int amount); out of the box. should support the optional callback URL. this is very important to allow users to get redirected to their platform after payment is made via PayStack.

Also, documentation should clearly state that the amount is in kobo.

could fix this with a PR though if you find it worthy.

adebisi-fa commented 4 years ago

Hello @Adekoreday,

Trust your compilers are cooperating!

Have you try using the request dto TransactionInitializeRequest, viz:

var response = _api.Initialize(new TransactionInitializeRequest {
    Email = "test@email.com",
    AmountInKobo = 45000, // This is for N450.00k
    CallbackUrl = "https://callback.domain.net/processor/path"
});

That would allow you to set all properties missing in the short-version of the Initialize(...) method.

Hope that helps.

- Foluso.

adebisi-fa commented 4 years ago

I'm closing this issue, for now.

Kindly re-open if there is any comment/reservation on the suggestion provided, to get this issue resolved.

Regards,

- Foluso

Adekoreday commented 4 years ago

Thanks for your response.

I have already done this since there are two overloads of the Initialize method in the TransactionApi.cs class. Just curious, is there a reason why you didn't include the callback url in the shorter version of initialize

adebisi-fa commented 4 years ago

Hello @Adekoreday,

Paystack makes it possible for a developer to set a global CallbackUrl from the Settings section on the account dashboard. As such, specifying a different CallbackUrl when initializing new transactions is optional, and only necessary when the global value is to be overwritten.

Since the shorter version of _api.Initialize(...) is meant to help the very basic usage of initialize endpoint, the CallbackUrlwas omitted.

Hope this helps.

Regards.

- Foluso

Adekoreday commented 4 years ago

Nice, thanks. it does.