New in Chargebee: Explore Reveal and understand your payment performance end-to-end.Try Now
Docschargebee docs
HomeBillingPaymentsRevRecGrowthReveal
Support

Product Updates


  • Release Notes

Getting Started


  • Overview
  • Chargebee Billing Data Centers
  • Object Relationship Model
  • Understanding Sites
  • Chargebee Tech Glossary
  • Articles and FAQ

Implementing Chargebee


  • Implementation Guide
  • Go-live Checklist
  • Articles and FAQ

AI in Chargebee


  • Chargebee Copilot
  • Chargebee Model Context Protocol (MCP) Server

Developer Resources


  • Developer Resources Overview
  • Articles and FAQ

Product Catalog


  • Product Catalog Overview
  • Coupons
  • Articles and FAQ

Subscriptions


  • Working with Subscriptions
  • Billing
  • Orders
  • Articles and FAQ

Customers


  • Managing Customers
  • Account Hierarchy
  • Email Notifications
  • Branding
  • Configure Multiple Languages
  • Articles and FAQ

Entitlements


  • Entitlements Overview
  • Features Overview
  • Feature Management
  • Managing Product Entitlements
  • Subscription Entitlements
  • Customer Entitlements
  • Grandfathering Entitlements
  • Articles and FAQ

Usage Based Billing


  • Understanding Usages
  • Setting up Usage Based Billing
  • Usage Alerts
  • Metered Billing
  • Articles and FAQ

Chargebee CPQ


  • Chargebee CPQ
  • Chargebee CPQ for Salesforce
  • Chargebee CPQ for HubSpot

Invoices, Credit Notes, and Quotes


  • Invoices
  • Credit Notes
  • Quotes [Legacy]
  • Transactions
  • Articles and FAQ

Taxes


  • Overview
  • Configuring Taxes
  • Country-specific Taxes
  • Articles and FAQ

Hosted Capabilities


  • Overview
  • Hosted Checkout
  • Hosted Self-Serve Portal
  • Hosted Pages Features
  • Additional Hosted Pages
  • Payment Components
  • Pricing Table
  • Managing Payments with Chargebee.js
  • Mobile-Optimized Hosted Pages
  • Articles and FAQ

Site Configuration


  • Users & Roles
  • Custom Fields & Metadata
  • Approvals
  • Mandatory Fields
  • File Attachments & Comments
  • Advanced Filter Options
  • Multicurrency Pricing
  • Multi-decimal Support
  • Configuring Reason Codes
  • Events and Webhooks
  • API Keys
  • Time Zone
  • Time Machine
  • Transfer Configurations
  • Articles and FAQ

Multi Business Entity


  • Multi Business Entity Overview
  • Customer Transfer Overview
  • Articles and FAQ

Mobile Subscriptions


  • Overview
  • Omnichannel Subscriptions
  • Omnichannel One-Time Orders
  • Mobile Subscriptions (Legacy)

Reports and Analytics


  • RevenueStory
  • Home Dashboard
  • Frequently Asked Questions
  • FAQs for Classic Reports Sunset
  • Articles and FAQ

Integrations


  • Sales
  • Customer Support and Success
  • Finance
  • Tax
  • eInvoicing
  • Marketing
  • Stitch
  • Collaboration
  • Contract Management
  • Ecommerce Management
  • Articles and FAQ

Data Privacy & Security


  • Two Factor Authentication
  • SAML Single Sign-On
  • System for Cross-Domain Identity Management (SCIM)
  • EU-GDPR
  • Consent Management
  • Personal Data Management
  • Compliance Certificates
  • HIPAA Guidelines
  • PCI Recommendations and Integration Types
  • Articles and FAQ

Data Operations


  • Bulk Operations
  • Migration
  • Articles and FAQ
  1. Billing
  2. Hosted Capabilities
  3. Articles and FAQ
  4. Portal V2 - Pop Up
  1. Billing
  2. Hosted Capabilities
  3. Articles and FAQ
  4. Portal V2 - Pop Up

I am trying to pass the MetaData parameter while updating subscriptions using API. However, the response does not have the metaData passed.

Problem Statement

This article helps you understand i am trying to pass the metadata parameter while updating subscriptions using api. however, the response does not have the metadata passed..

Solution

Scope

I am trying to pass the metaData parameter while updating subscriptions using API. However, the response does not have the metaData passed.

Summary

The solution article covers how to pass the metaData parameter while updating subscriptions.

Solution You would need to pass the value for the metaData parameter as a JSON string for this to work. "{"api_key_1":"dfads","api_key_2":"ewrqew"}". You can convert the JSON into JSON string using tool online.

Example API call

  curl  https://acme-test.chargebee.com/api/v2/subscriptions/16CLw5Taletv39AC/update_for_items   
  -u {site_api_key}  
  -d subscription_items[item_price_id][0]="monthly1-USD-Monthly"   
  -d subscription_items[unit_price][0]=9000   
  -d invoice_immediately="true"   
  -d meta_data="\{"api_key_1":"dfads","api_key_2":"ewrqew"}"

Response

  { 
  "subscription": { 
  "id": "16CLw5Taletv39AC",  
  "billing_period": 1,  
  "billing_period_unit": "month",  
  "remaining_billing_cycles": 3,  
  "customer_id": "ac-test",  
  "status": "active",  
  "current_term_start": 1680891849,  
  "current_term_end": 1683483849,  
  "next_billing_at": 1683483849,  
  "created_at": 1680891849,  
  "started_at": 1680891849,  
  "activated_at": 1680891849,  
  "updated_at": 1681498006,  
  "has_scheduled_changes": false,  
  "channel": "web",  
  "resource_version": 1681498006793,  
  "deleted": false,  
  "object": "subscription",  
  "currency_code": "USD",  
  "subscription_items": [{ 
  "item_price_id": "monthly1-USD-Monthly",  
  "item_type": "plan",  
  "quantity": 1,  
  "unit_price": 9000,  
  "amount": 9000,  
  "free_quantity": 0,  
  "billing_cycles": 3,  
  "object": "subscription_item"  
  },  
  { 
  "item_price_id": "addon1-USD-Monthly",  
  "item_type": "addon",  
  "quantity": 1,  
  "unit_price": 1200,  
  "amount": 1200,  
  "object": "subscription_item"  
  },  
  { 
  "item_price_id": "imp-charges1-USD-Monthly",  
  "item_type": "addon",  
  "quantity": 1,  
  "unit_price": 45200,  
  "amount": 45200,  
  "object": "subscription_item"  
  }  
  ],  
  "due_invoices_count": 0,  
  "mrr": 96400,  
  "exchange_rate": 1.0,  
  "base_currency_code": "USD",  
  "has_scheduled_advance_invoices": false,  
  "create_pending_invoices": false,  
  "auto_close_invoices": true,  
  "meta_data": { 
  "api_key_1": "dfads",  
  "api_key_2": "ewrqew"  
  }  
  },  
  "customer": { 
  "id": "ac-test",  
  "auto_collection": "on",  
  "net_term_days": 0,  
  "allow_direct_debit": false,  
  "created_at": 1675706413,  
  "taxability": "taxable",  
  "updated_at": 1681047602,  
  "pii_cleared": "active",  
  "channel": "web",  
  "resource_version": 1681047602832,  
  "deleted": false,  
  "object": "customer",  
  "card_status": "valid",  
  "promotional_credits": 0,  
  "refundable_credits": 0,  
  "excess_payments": 0,  
  "unbilled_charges": 0,  
  "preferred_currency_code": "USD",  
  "primary_payment_source_id": "pm_16CLyXTV6jRsn2nX",  
  "payment_method": { 
  "object": "payment_method",  
  "type": "card",  
  "reference_id": "tok_16CLyXTV6jRsa2nW",  
  "gateway": "chargebee",  
  "gateway_account_id": "gw_16BYibTKd9w0i7k1",  
  "status": "valid"  
  },  
  "auto_close_invoices": true  
  },  
  "card": { 
  "status": "valid",  
  "gateway": "chargebee",  
  "gateway_account_id": "gw_16BYibTKd9w0i7k1",  
  "iin": "411111",  
  "last4": "1111",  
  "card_type": "visa",  
  "funding_type": "credit",  
  "expiry_month": 12,  
  "expiry_year": 2024,  
  "created_at": 1675706439,  
  "updated_at": 1675706439,  
  "resource_version": 1675706439696,  
  "object": "card",  
  "masked_number": "**1111",  
  "customer_id": "ac-test",  
  "payment_source_id": "pm_16CLyXTV6jRsn2nX"  
  },  
  "credit_notes": []  
  }

Related Articles

How to mark some fields as mandatory in Checkout?
How to edit font in checkout and self serve portal?
How to hide plans/addons in Chargebee's portal?

Was this article helpful?