Credit Card Payments

Topics covered on this page

This article will highlight how you can charge a credit card.

All the following examples require that you first collect your customer card information in a token. All tokens are one time use so you must choose wisely between charging the card directly or associating that card to a customer for future use.

The main advantage of attaching a card to a customer is that it will let you charge their card more than once. Recurring customers can benefit from not having to repeatedly type their card details again for every purchase.

Charging the Card Directly

This is the easiest way to charge a card. Once you receive a card token, you send it to our charges API with the amount you want to charge. Within a few seconds the card will have been charged.

Note that the token will be void once it has been used; you won't be able to charge the card or create a customer with it anymore.

Here's an example using the Omise ruby library:

charge = Omise::Charge.create({
  amount: 100025,
  currency: "thb",
  description: "Order-345678",
  return_uri: "http://localhost/orders/345678/complete",
  card: params[:omise_token]
})

return_uri This is the url used for redirecting your customer back when 3-D Secure is used.

Charging a Customer

Creating customers with a token will let you charge a card multiple times if needed. With our customers API you could create checkout flows where your customers don't have to retype their card information all over again. This dramatically decreases the chance of cart abandonment.

We offer two ways to charge a customer.

Charging the Default Card

With the default card, you only pass the customer ID. This is useful if you only want to have one card per customer.

Here's an example using the Omise ruby library:

charge = Omise::Charge.create({
  amount: 100025,
  currency: "thb",
  description: "Order-345678",
  return_uri: "http://localhost/orders/345678/complete",
  customer: user.omise_customer_id
})

Charging a Specific Card

With a specific card, you pass both a customer ID and the specific card ID. This is particularly useful if you have multiple cards attached to a customer.

Note that unlike charging a card directly with a token to create the charge you have to pass the actual card ID instead of the token ID. You can read how to list all customer cards and the pagination documentation to see how to retrieve a list of cards for a specific customer.

Here's an example using the Omise ruby library:

charge = Omise::Charge.create({
  amount: 100025,
  currency: "thb",
  description: "Order-345678",
  return_uri: "http://localhost/orders/345678/complete",
  customer: customer.omise_id
  card: customer.cards.find_by(id: params[:id]).omise_id
})

Charge status (with 3-D Secure enabled)

Status Description
successful The card was successfully charged (authorized = true and paid = true)
pending Either:
reversed The authorized charge was reversed to release the amount on hold
expired The charge was pending manual capture. No action was taken to capture the charge within holding period.
failed The charge failed. You can check the reason from the failure_code and failure_message in the charge result

Charge status (3-D Secure disabled)

Status Description
successful The card was successfully charged (authorized = true and paid = true)
pending The charge has been authorized only, pending manual capture (authorized = true and capture = false)
reversed The authorized charge was reversed to release the amount on hold
expired The charge was pending manual capture. No action was taken to capture the charge within holding period.
failed The charge failed. You can check the reason from the failure_code and failure_message in the charge result

Limits

Thailand

  • Minimum: 2000 (THB 20.00)
  • Maximum: 15000000 (THB 150,000.00)

Singapore

  • Minimum: 100 (SGD 1.00)
  • Maximum: 2000000 (SGD 20,000.00)

Malaysia

  • Minimum: 100 (MYR 1.00)
  • Maximum: 3000000 (MYR 30,000.00)

Japan

  • Minimum: 100 (JPY 100)
  • Maximum: 6000000 (JPY 6,000,000)
Omise uses cookies to improve your overall site experience and collect information on your visits and browsing behavior. By continuing to browse our website, you agree to our Privacy Policy. Learn more