Credit Card Payments

Topics covered on this page

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

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

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

Charging the Card Directly

This is the easiest way to charge a card. Once you receive a card token, send it to our charges API with the amount you want to charge. Within a few seconds, the card will be 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 to redirect your customer 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 customers don't have to retype their card information repeatedly. 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

You pass a customer ID and the particular card ID when using a specific card. This is particularly useful if a customer has multiple cards attached.

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 the 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 the 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