Skip to content

使用 updateSession 函数保存一个对象出错了 #89

@polunzh

Description

@polunzh

数据中包含 Payment Kit 中一个 price 对象,直接保存 checkoutSession 数据会报错:
image

使用 JSON.stringify 之后的数据:

{"checkoutSessionId":"cs_cfdjZ3MMWt82MyzDpSQz8U05uIPq9KhPXDgscnpn0VbCFGdhEM63i1w221","price":{"id":"price_JVmXoxbEq7VmDNi8Igw8sw54","product_id":"prod_dtpwaPvnJF2rde","nickname":"","active":true,"livemode":false,"locked":true,"type":"recurring","billing_scheme":"per_unit","unit_amount":"100000000000000000","recurring":{"interval_config":"day_1","interval":"day","interval_count":1,"usage_type":"metered","aggregate_usage":"sum"},"tiers_mode":null,"tiers":null,"custom_unit_amount":null,"lookup_key":"","metadata":{},"transform_quantity":{"divide_by":86400,"round":"up"},"currency_id":"pc_jTR25UMb8dCE","currency_options":[{"currency_id":"pc_jTR25UMb8dCE","unit_amount":"100000000000000000","tiers":null,"custom_unit_amount":null},{"currency_id":"pc_LwsO2ZbnYMRc","unit_amount":"10"}],"created_at":"2024-03-16T02:55:15.906Z","created_via":"dashboard","updated_at":"2024-09-12T02:05:54.223Z","upsell":null,"quantity_available":0,"quantity_sold":0,"quantity_limit_per_checkout":0,"product":{"id":"prod_dtpwaPvnJF2rde","active":true,"livemode":false,"locked":false,"type":"service","name":"On Demand Space","description":"On Demand Space","images":[],"features":[{"name":"免费生成 HTTPS 证书"},{"name":"支持 DID Domain"},{"name":"支持从官方 Store 安装组件"}],"unit_label":"Component","default_price_id":"price_JVmXoxbEq7VmDNi8Igw8sw54","metadata":{"nft_type":"BlockletServerServerlessNFT","nft_factory":"z3Ct4Y7CVcYQfWhX2KCHvEJWxZ4Vjd34NRJai","name.en":"On Demand Space","name.zh":"按需空间"},"statement_descriptor":"","nft_factory":null,"created_at":"2024-02-01T10:06:26.997Z","created_via":"api","updated_at":"2024-08-30T11:27:54.108Z","cross_sell":null}}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions