Jump to content
Andrea Raimondi

Anyone knows of a good Delphi library encapsulating Stripe payments?

Recommended Posts

20 minutes ago, Graham Murt said:

I'm not exactly sure what you are asking here, Stripe is a payment gateway - license keys would need to be handled by your own software.  If you're simply asking what email service I use, I use the SES service from Amazon Web Services.  I also have written an interface to this service so I'll upload that shortly to my GitHub page.

Let me explain, usually after a customer bought a software, s/he actually bought a license key, right?

So how the license key is delivered to the customer? We usually send it through email, with the payment processing platform I've used in the past, the license key delivery is done by their email system, which is usually more reliable then ourselves because it can usually go through the spam-filtering system all around.

 

I'm also using SES, but through the SMTP interface. I remember with SES, all the target email addresses have to be approved by the SES system, maybe that's because I'm using the free plan, not sure...

Share this post


Link to post
Just now, Edwin Yip said:

Let me explain, usually after a customer bought a software, s/he actually bought a license key, right?

So how the license key is delivered to the customer? We usually send it through email, with the payment processing platform I've used in the past, the license key delivery is done by their email system, which is usually more reliable then ourselves because it can usually go through the spam-filtering system all around.

 

I'm also using SES, but through the SMTP interface. I remember with SES, all the target email addresses have to be approved by the SES system, maybe that's because I'm using the free plan, not sure...

I'm not sure Stripe has any support for License Key managment.  With regards to SES, No the target emails do not need to be verified, you only need to verify email addresses which you want to send emails "from", i.e. the Sender address.  Not sure if it's of any use, but I've just uploaded my SES code to GitHub.  Again, doesn't support all SES functionality but works well for me and can be added to if required.  https://github.com/gmurt/ksSes

Share this post


Link to post
46 minutes ago, Graham Murt said:

I'm not sure Stripe has any support for License Key managment.  With regards to SES, No the target emails do not need to be verified, you only need to verify email addresses which you want to send emails "from", i.e. the Sender address.  Not sure if it's of any use, but I've just uploaded my SES code to GitHub.  Again, doesn't support all SES functionality but works well for me and can be added to if required.  https://github.com/gmurt/ksSes

Thanks! Definitely it'll be useful to the rest of us!

 

Actually I've cloned your old version of ksSES to my local computer, before it's somehow disappeared like ksStripe :D

There is a file called synacode.pas which is missing from the new version you've just published, I assume it's no longer needed.

Update 1:  First try: Just FYI - like ksStripe, it requires the new http client introduced since XE7 :)

Edited by Edwin Yip

Share this post


Link to post
15 minutes ago, Edwin Yip said:

Thanks! Definitely it'll be useful to the rest of us!

 

Actually I've cloned your old version of ksSES to my local computer, before it's somehow disappeared like ksStripe 😄

There is a file called synacode.pas which is missing from the new version you've just published, I assume it's no longer needed.

Update 1:  First try: Just FYI - like ksStripe, it requires the new http client introduced since XE7 🙂

Yes, we need Synacode.pas from the synapse library to use the HMAC_SHA1 function.  http://svn.code.sf.net/p/synalist/code/trunk/

 

I'm still not 100% of what I'm allowed to GitHub... am I allowed to include this source file from Synapse in my Repo? Obviously without changing it in any way.  Let me know, if it's allowed, I'll include it.

 

No problem, I'll add support for Indy for the next update.

Share this post


Link to post
1 hour ago, Graham Murt said:

Yes, we need Synacode.pas from the synapse library to use the HMAC_SHA1 function.  http://svn.code.sf.net/p/synalist/code/trunk/

 

I'm still not 100% of what I'm allowed to GitHub... am I allowed to include this source file from Synapse in my Repo? Obviously without changing it in any way.  Let me know, if it's allowed, I'll include it.

 

No problem, I'll add support for Indy for the next update.

I think even if the Synapse library allows you to redistribute Synacode.pas, it's not a good practice to do that, but instead, you should just state the dependency of Synapse in the readme file. Just my 2 cents.

Share this post


Link to post
33 minutes ago, Edwin Yip said:

I think even if the Synapse library allows you to redistribute Synacode.pas, it's not a good practice to do that, but instead, you should just state the dependency of Synapse in the readme file. Just my 2 cents.

Why not? Self-contained repos are very good. The source repo could be down, or it could contain a version which introduced some breaking changes that won't compile, or it could be just untested.

No problem in using 3rd party units in own projects, IMHO

Share this post


Link to post
1 minute ago, Fr0sT.Brutal said:

Why not? Self-contained repos are very good. The source repo could be down, or it could contain a version which introduced some breaking changes that won't compile, or it could be just untested.

No problem in using 3rd party units in own projects, IMHO

It's only a single file so it might make sense in this case, but we usually have to consider not making any duplicate, because it's hard to sync with new changes in the other library.

Share this post


Link to post
8 hours ago, Edwin Yip said:

It's only a single file so it might make sense in this case, but we usually have to consider not making any duplicate, because it's hard to sync with new changes in the other library.

I've updated the repo with the synacode.pas file.

  • Like 1

Share this post


Link to post
On 10/19/2020 at 8:02 PM, Graham Murt said:

Yes, we need Synacode.pas from the synapse library to use the HMAC_SHA1 function.  http://svn.code.sf.net/p/synalist/code/trunk/

 

I'm still not 100% of what I'm allowed to GitHub... am I allowed to include this source file from Synapse in my Repo? Obviously without changing it in any way.  Let me know, if it's allowed, I'll include it.

 

No problem, I'll add support for Indy for the next update.

I will try and test it immediately once you added Indy support :)

Share this post


Link to post
On 10/19/2020 at 8:02 PM, Graham Murt said:

No problem, I'll add support for Indy for the next update.

Hello Graham, in case you have any uncommited changes for ksSES please commit it.

In a few days I'll add old version support if you haven't done that  by that time :)

My idea is to abstract out a general 'IHttpClient' so that it can be replaced by Indy or mORMot.

Edited by Edwin Yip

Share this post


Link to post

Hi Edwin,

 

I will modify the code today to abstract out the http interface. I was working last night on merging the ksS3 and ksSES code to use the same base classes. Working really well with both now sharing the same signature generation code.

 

I’ve merged both ksSES and ksS3 into a more suitable ksAWS repo here which I’ll publish later today along with more functionality added to the ksSES interface.

 

Kind regards,

Graham

  • Like 2

Share this post


Link to post
1 hour ago, Graham Murt said:

Hi Edwin,

 

I will modify the code today to abstract out the http interface. I was working last night on merging the ksS3 and ksSES code to use the same base classes. Working really well with both now sharing the same signature generation code.

 

I’ve merged both ksSES and ksS3 into a more suitable ksAWS repo here which I’ll publish later today along with more functionality added to the ksSES interface.

 

Kind regards,

Graham

That's Great! Great! Great Graham!

Share this post


Link to post

Hi Edwin,

 

Ok, I've merged ksSES and ksS3 into a single code-base. I've added a VerifySender method to the SES interface also. Lots of refactoring of the units will allow us to easily add more API methods and hopefully branch out into other AWS services.

 

https://github.com/gmurt/ksAws

 

I've also added support for NetHttp and Indy via a Http interface unit.  To use Indy, simply remove the "." (period) character from this define in the ksAwsHttpIntf unit.  {.$DEFINE USE_INDY_HTTP} 

 

I'll close down the existing S3 and SES repos later today and direct everyone to the new ksAws repo.

  • Like 3

Share this post


Link to post
40 minutes ago, Graham Murt said:

Hi Edwin,

 

Ok, I've merged ksSES and ksS3 into a single code-base. I've added a VerifySender method to the SES interface also. Lots of refactoring of the units will allow us to easily add more API methods and hopefully branch out into other AWS services.

 

https://github.com/gmurt/ksAws

 

I've also added support for NetHttp and Indy via a Http interface unit.  To use Indy, simply remove the "." (period) character from this define in the ksAwsHttpIntf unit.  {.$DEFINE USE_INDY_HTTP} 

 

I'll close down the existing S3 and SES repos later today and direct everyone to the new ksAws repo.

You are fast Graham! I'll check it ASAP!

Share this post


Link to post
20 hours ago, Graham Murt said:

Hi Edwin,

 

Ok, I've merged ksSES and ksS3 into a single code-base. I've added a VerifySender method to the SES interface also. Lots of refactoring of the units will allow us to easily add more API methods and hopefully branch out into other AWS services.

 

https://github.com/gmurt/ksAws

 

I've also added support for NetHttp and Indy via a Http interface unit.  To use Indy, simply remove the "." (period) character from this define in the ksAwsHttpIntf unit.  {.$DEFINE USE_INDY_HTTP} 

 

I'll close down the existing S3 and SES repos later today and direct everyone to the new ksAws repo.

Hello Graham,

Just tried it - it seems that the SHA256 hasing and URL encoding/decoding still depends on the `Net.*` units of newer Delphi.

Maybe still have to abstract out a `IUtilityService' interface? :D

Share this post


Link to post
3 hours ago, Graham Murt said:

I've installed XE4 here.  Working on compatibility. 

Wow, that's great! I hope some day I can contribute a mORMot http client.

 

Looks like your project can be used as a  foundation for implementing various REST client for various web APIs.

Share this post


Link to post

Ok, I've just pushed an update to GitHub.  I installed XE4 here and now it's working well I think.  Required quite a few changes throughout but this has improved the codebase. 

 

Grab the latest code and let me know if you have any issues.

Share this post


Link to post
1 hour ago, Graham Murt said:

Ok, I've just pushed an update to GitHub.  I installed XE4 here and now it's working well I think.  Required quite a few changes throughout but this has improved the codebase. 

 

Grab the latest code and let me know if you have any issues.

Thanks Graham! The 'GetVerifiedSenders' sample project can be built without any issue!

 

Now trying to run it. In the code you have a hint about creating the SMTP credentials in the 'SES->SMTP Settings` AWS SES console. 

Are you sure that is right? IIRC the SMTP username/password are for SMTP access only, but ksSES is accessing SES via HTTP?

Explorer the SES console now...

Share this post


Link to post

Ah sorry this is a mistake. All credentials need to be created i the AWS IAM service. I’ll update this in the next push to the repo.

Share this post


Link to post

Hello Graham,

 

I created an IAM user along with an access key, the VerifiedSenders project returned the correct list!

 

Will try email sending later. BTW, do you happen to know with SES, if I will face any anti-spam or 'credit scores' issue if I suddenly starting sending email to a lot of target emails?

 

 

Share this post


Link to post
On 10/25/2020 at 10:38 PM, Graham Murt said:

Ah sorry this is a mistake. All credentials need to be created i the AWS IAM service. I’ll update this in the next push to the repo.

Hello Graham,

 

I'm trying the `SendEmail` method with the Indy http client, and got the `HTTP/1.1 505 HTTP Version not supported` error. 

While I'm searching for the solution, do you have any hints? Thanks!

 

I added a github issue here so that it's easier to track it.

Edited by Edwin Yip

Share this post


Link to post

We should probably move this to a new thread as this thread was initially about Stripe.  I've just pushed a ksAws update which will hopefully improve support for Indy.

Share this post


Link to post

@Graham Murt i know this is a little old, but trying to get stripe payment-intents to work with delphi fmx. Using rest components.  Not having best of luck,  do you happen to have anything that could help? 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×