Skip to content

Instantly share code, notes, and snippets.

@gr2m
Last active April 29, 2024 19:17
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save gr2m/5463675 to your computer and use it in GitHub Desktop.
Save gr2m/5463675 to your computer and use it in GitHub Desktop.
Imagine you could purchase items from your store, with pure JavaScript in the browser. How would it look like? Here's what I came up with. Forks & comments much appreciated! #nobackend #dreamcode
// purchase a product with a credit card
purchase('productId')
.using( {
cc: "4556934156210213",
valid: "2016-10",
csc: "123"
} )
// purchase a product with paypal
purchase('productId')
.using( 'paypal' )
// upgrade a user to a pro plan, payment via paypal.
purchase(
account.upgradoTo( 'pro' )
).using('paypal')
@kareraisu
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment