🖥

#Stripe CLI create customer / plan and product / example with jq comm

2019/12/07に公開
customer=$(stripe customers create)
echo "$customer" | jq

customer_id=$(echo "$customer" | jq -r '.id')
echo "$customer_id"

# Create Plan and Product in both time
# https://stripe.com/docs/api/plans/create?lang=curl
# https://stripe.com/docs/billing/subscriptions/products-and-plans
plan=$(stripe plans create --interval='month' --currency='jpy' --amount='1000' --data="product[name]"="Gold special")
echo "$plan" | jq
$ source ~/tmp/stripe.sh
{
  "id": "cus_GJECStm3dFN2WT",
  "object": "customer",
  "address": null,
  "balance": 0,
  "created": 1575619270,
  "currency": null,
  "default_source": null,
  "delinquent": false,
  "description": null,
  "discount": null,
  "email": null,
  "invoice_prefix": "E11C8A4A",
  "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_GJECStm3dFN2WT/sources"
  },
  "subscriptions": {
    "object": "list",
    "data": [],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/customers/cus_GJECStm3dFN2WT/subscriptions"
  },
  "tax_exempt": "none",
  "tax_ids": {
    "object": "list",
    "data": [],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/customers/cus_GJECStm3dFN2WT/tax_ids"
  },
  "tax_info": null,
  "tax_info_verification": null
}
cus_GJECStm3dFN2WT
{
  "id": "plan_GJEC5HQpDdCiRh",
  "object": "plan",
  "active": true,
  "aggregate_usage": null,
  "amount": 1000,
  "amount_decimal": "1000",
  "billing_scheme": "per_unit",
  "created": 1575619271,
  "currency": "jpy",
  "interval": "month",
  "interval_count": 1,
  "livemode": false,
  "metadata": {},
  "nickname": null,
  "product": "prod_GJECZk7rgYpkh0",
  "tiers": null,
  "tiers_mode": null,
  "transform_usage": null,
  "trial_period_days": null,
  "usage_type": "licensed"
}

Original by Github issue

https://github.com/YumaInaura/YumaInaura/issues/2815

チャットメンバー募集

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

https://line.me/ti/g2/eEPltQ6Tzh3pYAZV8JXKZqc7PJ6L0rpm573dcQ

Twitter

https://twitter.com/YumaInaura

公開日時

2019-12-07

Discussion