Stripe: Charge a Card on file

Previously I added the ability to store a credit card to a customer on Stripe. This was for use with Stripe’s plan/subscription functions. Stripe will also let you easily charge a credit card that you have put on file. I’ve added that capability to StripeX with the ChargeCard() function.

I also did some minor tweaks to a couple other functions.

local o
o = NEWOBJECT("StripeX")
o.cAPIKey = "YourAPIKey"
IF !o.Authenticate() && Make sure Stripe working
?"Auth", "Failed", o.cErrorMessage
ELSE
?"Good Auth"
endif
LOCAL lCustomer, lCard
lCustomer = "YourCustomerID"
lCard = "TheCardIDOnThatCustomer"
* Charge a card on file
?"Charge", o.ChargeCard(lCustomer, lCard, 1.00, "Stripe Desc", "Statement Desc")
?o.cErrorMessage

view raw
StripeXChargeCard
hosted with ❤ by GitHub

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s