このページは現在翻訳中です。
1 mins read

Identifying credit card expiry date

Omise

Many of your customers may have chosen to save their cards with Omise. Reminding them of their credit card expiry date is another way to prevent failed charges. Here's a quick tip from us on how you can search for your customer's card expiry date (default card) using Pry and Omise’s Ruby library.


# Run pry
pry

# Read out Omise
requires "omise"

# Set the API key
Omise.api_key = "secret key"

# Update the description and retrieve Customer
customer_id = "cust_test_xxxxx"
customer = Omise::Customer.retrieve(customer_id)

# Retrieve the expiry date of the Customer's default card
expiration_month = customer.default_card.expiration_month
expiration_year = customer.default_card.expiration_year
expiration = "#{expiration_month}/#{expiration_year}"

# Input the default card’s expiry date in the description
customer.update({description: expiration})

# Searching for a Customer with the default card 
search_result = Omise::Search.execute(scope: "customer", query: expiration)
search_result.data.each do |customer|

# ここで有効期限が切れそうなcustomerへ何かをする処理をいれる。

end

Now you can notify your customers before their card expires. And since you can list all Customers Omise::Customer.list, you can update all descriptions in one go.

We hope you find this useful! For questions or feedback, dont hesitate to get in touch. Email us at support@omise.co

Translated from 決済APIでカードの有効期限切れの対応ってどうするの? written by Akira Narita, Lead Deverloper at Omise.

詳細はこちらから

5 mins read

Unlock your business potential in Asia with Alipay+

7 mins read

How PayNow improves payment experiences

3 mins read

Why PayNow matters

メールを登録しOmiseからの更新情報を受け取る
購読してくれてありがとう

メールにサインアップしていただきありがとうございます

Omiseは、お客様のウェブサイト全般における利便性を向上するためにクッキーを利用し、お客様のアクセス、閲覧履歴に関する情報を収集します。 当社のウェブサイトを閲覧し続けることにより、お客様は当社のプライバシーポリシーに同意することとします。 詳細はこちら