{"_id":"572be2adde40590e00026935","githubsync":"","parentDoc":null,"user":"55dd080d0efd5821000d53b3","project":"55dd0853d2d97337001800e2","category":{"_id":"572be252de40590e00026934","project":"55dd0853d2d97337001800e2","version":"55de36ec9067202b00de0015","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-05-06T00:16:18.383Z","from_sync":false,"order":5,"slug":"billing-portal","title":"Billing Portal"},"__v":4,"version":{"_id":"55de36ec9067202b00de0015","__v":33,"project":"55dd0853d2d97337001800e2","createdAt":"2015-08-26T22:00:12.384Z","releaseDate":"2015-08-26T22:00:12.383Z","categories":["55de36ed9067202b00de0016","55de36ed9067202b00de0017","55de36ed9067202b00de0018","55df7dcd437b3f0d004ba204","55e4e014177b6e0d00333141","55e4e01fe252ac0d00303a99","55e4e05240cda60d003bad67","55e4e070177b6e0d00333142","55e4e0753325e60d007fbee6","55e4e0803325e60d007fbee7","55e4e086177b6e0d00333143","55e4e0a1177b6e0d00333144","55e4e0aa3325e60d007fbee8","55e4e0b140cda60d003bad6b","55e4e0bae252ac0d00303a9d","55e4e0c5177b6e0d00333145","55e4e0ee3325e60d007fbeea","55e4e0fae252ac0d00303a9e","55e4e100177b6e0d00333147","55f85c8ba3271b0d00498d55","56092e1ac5cff70d007d0131","564b64a3ee12850d0095866e","564b64b5791099170071e9ea","565cd0bfd18ae50d007183d8","565f5f5d6bafd40d0030a063","565f790d6bafd40d0030a09f","56611c464851190d003f9f5d","56637d5b7988ab0d00d0522e","56637d687988ab0d00d0522f","567835df6928b40d009dd650","56e59c043c29b117008dae5b","5704013559c5190e000ab646","572be252de40590e00026934","58af1bf6ebd7370f0078ba09","5cdad81d912ece0039e9a939"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"3.0.0","version":"3.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-05-06T00:17:49.223Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"payment\\\" : {\\n    \\\"amount\\\" : 10.00\\n  },\\n  \\\"currency\\\" : \\\"USD\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Init JSON Parameter\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://api.paystand.co/v3/plugins/paystand/checkout?init={\\\"k\\\":\\\"0yqowfwfxb2vpnuv9ovpqvgt\\\",\\\"h\\\":\\\"https://checkout.paystand.co/v3/\\\",\\\"o\\\":\\\"https://api.paystand.co\\\",\\\"p\\\":{\\\"a\\\":\\\"5000.20\\\"},\\\"c\\\":\\\"USD\\\",\\\"m\\\":[\\\"echeck\\\", \\\"card\\\"],\\\"b\\\":{\\\"s\\\": \\\"41 Grandview St\\\",\\\"c\\\":\\\"Santa Cruz\\\",\\\"p\\\":\\\"95060\\\",\\\"d\\\":\\\"CA\\\",\\\"u\\\":\\\"USA\\\"},\\\"y\\\":{\\\"n\\\":\\\"Christina Chan\\\",\\\"e\\\":\\\"demo%2Bcchan:::at:::paystand.com\\\"},\\\"z\\\":{\\\"foo\\\":{\\\"bar\\\":\\\"quux\\\",\\\"baz\\\":\\\"norf\\\"}}}\\n\",\n      \"language\": \"http\",\n      \"name\": \"Payment\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://api.paystand.co/v3/plugins/paystand/checkout?init={\\\"k\\\":\\\"0yqowfwfxb2vpnuv9ovpqvgt\\\",\\\"h\\\":\\\"https://checkout.paystand.co/v3/\\\",\\\"o\\\":\\\"https://api.paystand.co\\\",\\\"c\\\":\\\"USD\\\",\\\"m\\\":[\\\"echeck\\\",\\\"card\\\"],\\\"b\\\":{\\\"s\\\":\\\"100 Bay St\\\",\\\"c\\\":\\\"Santa Cruz\\\",\\\"p\\\":\\\"95060\\\",\\\"d\\\":\\\"CA\\\",\\\"u\\\":\\\"USA\\\"},\\\"y\\\":{\\\"n\\\": \\\"Christina Chan\\\",\\\"e\\\":\\\"demo%2Bcchan@paystand.com\\\"},\\\"z\\\":{\\\"foo\\\":{\\\"bar\\\":\\\"quux\\\",\\\"baz\\\":\\\"norf\\\"}},\\\"r\\\":{\\\"n\\\":\\\"One year lease\\\",\\\"d\\\":\\\"120 Swift St. 12 Month Lease\\\",\\\"i\\\":[{\\\"n\\\":\\\"Monthly Rent\\\",\\\"d\\\":\\\"Rent of $1200 is due on the first of every month\\\",\\\"s\\\":{\\\"n\\\":\\\"Rent\\\",\\\"d\\\":\\\"Pay rent on the 1st of the month\\\",\\\"i\\\":\\\"month\\\",\\\"c\\\":\\\"1\\\",\\\"a\\\":\\\"start\\\",\\\"s\\\":\\\"2016-04-01T00:00\\\",\\\"t\\\":\\\"12\\\"},\\\"a\\\":\\\"1200.00\\\"},{\\\"n\\\":\\\"Application Fee\\\",\\\"d\\\":\\\"One time application fee of $150.00\\\",\\\"s\\\":{\\\"n\\\":\\\"Application Fee\\\",\\\"d\\\":\\\"Pay a one time non-refundable application fee\\\"},\\\"a\\\":\\\"150.00\\\"},{\\\"n\\\":\\\"Security Deposit\\\",\\\"d\\\":\\\"$2000 Refundable security deposit that can be used to cover damages\\\",\\\"s\\\":{\\\"n\\\":\\\"Deposit\\\",\\\"d\\\":\\\"Security deposit or the home\\\",\\\"s\\\":\\\"2016-04-01T00:00\\\"},\\\"a\\\":\\\"2000.00\\\"}]}}\\n\",\n      \"language\": \"http\",\n      \"name\": \"Scheduled Payment\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\nThe Billing Portal can be initialized by adding a parameter named \"init\" to the billing portal URL with a JSON formatted and URL encoded value representing a checkout [initialization object](doc:checkout-init-object).\n\nUsing a URL encoded, JSON formatted [initialization object](doc:checkout-init-object) in the URL is primarily useful when the object and URL are programmatically generated.\n\nAn example use case is an invoicing application which automatically generates the Billing Portal URL with an init parameter specifying the amount, currency, invoice number, customer, etc. and injects it in the emailed PDF invoice. JSON formatting and URL encoding an [initialization object](doc:checkout-init-object) in such an environment is typically very straightforward and concise.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"URL Encoding\",\n  \"body\": \"**All parameter values containing non-alphanumeric characters** passed in the URL need to be URL encoded regardless of which parameter format is being used.\"\n}\n[/block]","excerpt":"","slug":"portal-init-json-parameter","type":"basic","title":"Init JSON Parameter"}

Init JSON Parameter


[block:code] { "codes": [ { "code": "{\n \"payment\" : {\n \"amount\" : 10.00\n },\n \"currency\" : \"USD\"\n}", "language": "json", "name": "Init JSON Parameter" } ], "sidebar": true } [/block] [block:code] { "codes": [ { "code": "https://api.paystand.co/v3/plugins/paystand/checkout?init={\"k\":\"0yqowfwfxb2vpnuv9ovpqvgt\",\"h\":\"https://checkout.paystand.co/v3/\",\"o\":\"https://api.paystand.co\",\"p\":{\"a\":\"5000.20\"},\"c\":\"USD\",\"m\":[\"echeck\", \"card\"],\"b\":{\"s\": \"41 Grandview St\",\"c\":\"Santa Cruz\",\"p\":\"95060\",\"d\":\"CA\",\"u\":\"USA\"},\"y\":{\"n\":\"Christina Chan\",\"e\":\"demo%2Bcchan@paystand.com\"},\"z\":{\"foo\":{\"bar\":\"quux\",\"baz\":\"norf\"}}}\n", "language": "http", "name": "Payment" } ], "sidebar": true } [/block] [block:code] { "codes": [ { "code": "https://api.paystand.co/v3/plugins/paystand/checkout?init={\"k\":\"0yqowfwfxb2vpnuv9ovpqvgt\",\"h\":\"https://checkout.paystand.co/v3/\",\"o\":\"https://api.paystand.co\",\"c\":\"USD\",\"m\":[\"echeck\",\"card\"],\"b\":{\"s\":\"100 Bay St\",\"c\":\"Santa Cruz\",\"p\":\"95060\",\"d\":\"CA\",\"u\":\"USA\"},\"y\":{\"n\": \"Christina Chan\",\"e\":\"demo%2Bcchan@paystand.com\"},\"z\":{\"foo\":{\"bar\":\"quux\",\"baz\":\"norf\"}},\"r\":{\"n\":\"One year lease\",\"d\":\"120 Swift St. 12 Month Lease\",\"i\":[{\"n\":\"Monthly Rent\",\"d\":\"Rent of $1200 is due on the first of every month\",\"s\":{\"n\":\"Rent\",\"d\":\"Pay rent on the 1st of the month\",\"i\":\"month\",\"c\":\"1\",\"a\":\"start\",\"s\":\"2016-04-01T00:00\",\"t\":\"12\"},\"a\":\"1200.00\"},{\"n\":\"Application Fee\",\"d\":\"One time application fee of $150.00\",\"s\":{\"n\":\"Application Fee\",\"d\":\"Pay a one time non-refundable application fee\"},\"a\":\"150.00\"},{\"n\":\"Security Deposit\",\"d\":\"$2000 Refundable security deposit that can be used to cover damages\",\"s\":{\"n\":\"Deposit\",\"d\":\"Security deposit or the home\",\"s\":\"2016-04-01T00:00\"},\"a\":\"2000.00\"}]}}\n", "language": "http", "name": "Scheduled Payment" } ], "sidebar": true } [/block] The Billing Portal can be initialized by adding a parameter named "init" to the billing portal URL with a JSON formatted and URL encoded value representing a checkout [initialization object](doc:checkout-init-object). Using a URL encoded, JSON formatted [initialization object](doc:checkout-init-object) in the URL is primarily useful when the object and URL are programmatically generated. An example use case is an invoicing application which automatically generates the Billing Portal URL with an init parameter specifying the amount, currency, invoice number, customer, etc. and injects it in the emailed PDF invoice. JSON formatting and URL encoding an [initialization object](doc:checkout-init-object) in such an environment is typically very straightforward and concise. [block:callout] { "type": "warning", "title": "URL Encoding", "body": "**All parameter values containing non-alphanumeric characters** passed in the URL need to be URL encoded regardless of which parameter format is being used." } [/block]