LoginSignup
1
0

More than 1 year has passed since last update.

#Stripe #API でカスタマー = 顧客を作成・取得する ( 公式ドキュメントのまま ) ( #Ruby )

Last updated at Posted at 2019-12-02

Command

Ruby

require 'stripe'
Stripe.api_key = 'sk_test_xxxxx'

Stripe::Customer.create({
  description: 'Customer for jenny.rosen@example.com',
})

curl

curl https://api.stripe.com/v1/customers -u sk_test_xxxxx: -d description="Customer for jenny.rosen@example.com"

API Doc

example

$ curl -s curl https://api.stripe.com/v1/customers -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: -d description="Customer for jenny.rosen@example.com"
{
  "id": "cus_GHaC8VxZWYuwcl",
  "object": "customer",
  "account_balance": 0,
  "address": null,
  "balance": 0,
  "created": 1575239418,
  "currency": null,
  "default_source": null,
  "delinquent": false,
  "description": "Customer for jenny.rosen@example.com",
  "discount": null,
  "email": null,
  "invoice_prefix": "B92698A0",
  "invoice_settings": {
    "custom_fields": null,
    "default_payment_method": null,
    "footer": null
  },
  "livemode": false,
  "metadata": {
  },
  "name": null,
  "phone": null,
  "preferred_locales": [

  ],
  "shipping": null,
  "sources": {
    "object": "list",
    "data": [

    ],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/customers/cus_GHa5lNIgPs4wF3/sources"
  },
  "subscriptions": {
    "object": "list",
    "data": [

    ],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/customers/cus_GHa5lNIgPs4wF3/subscriptions"
  },
  "tax_exempt": "none",
  "tax_ids": {
    "object": "list",
    "data": [

    ],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/customers/cus_GHa5lNIgPs4wF3/tax_ids"
  },
  "tax_info": null,
  "tax_info_verification": null
}

ダッシュボードで確認

image

発行された customer_id がURLにも反映されるみたいだ

image

Original by Github issue

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0