This guide is designed to get you testing and seeing how easy you can start charging with Omise as quickly as possible.
Just to get the idea how it works. Open the terminal and you may set the public and secret key in env like so:
export OMISE_PUBLIC_KEY=<Public key> export OMISE_SECRET_KEY=<Secret key>
Then, fill in card information to create a one-time token and start charging!
token_id=$(curl https://vault.omise.co/tokens \ -X POST \ -u "$OMISE_PUBLIC_KEY": \ -d "card[name]=JOHN DOE" \ -d "card[city]=Bangkok" \ -d "card[postal_code]=10320" \ -d "card[number]=4242424242424242" \ -d "card[security_code]=123" \ -d "card[expiration_month]=2" \ -d "card[expiration_year]=2019" \ | jq ".id" \ | sed 's/"//g') \ && curl https://api.omise.co/charges \ -X POST \ -u "$OMISE_SECRET_KEY": \ -d "description=Charge for order 3947" \ -d "amount=2000" \ -d "currency=thb" \ -d "card=$token_id"
Note: to be able to use
jq command, you may have to install it first. On OSX just do
brew install jq or download/install from github for other OSes.