"use strict";(self.webpackChunknewoaks_help=self.webpackChunknewoaks_help||[]).push([[7602],{3776:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>h,frontMatter:()=>o,metadata:()=>t,toc:()=>c});const t=JSON.parse('{"id":"custom-payment-subscription","title":"3rd Party Payment - Subscription Management","description":"Step 1: Get Subscription Detail Configuration","source":"@site/Integration/010.custom-payment-subscription.md","sourceDirName":".","slug":"/custom-payment-subscription","permalink":"/guides/integration/custom-payment-subscription","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":10,"frontMatter":{"sidebar_position":10},"sidebar":"sidebar","previous":{"title":"White Label Payment Process - 3rd Party Payment","permalink":"/guides/integration/custom-payment-integration"},"next":{"title":"Native Stripe integration","permalink":"/guides/integration/stripe-integration"}}');var r=s(4848),i=s(8453);s(767),s(9357),s(8175);const o={sidebar_position:10},a="3rd Party Payment - Subscription Management",l={},c=[{value:"Step 1: Get Subscription Detail Configuration",id:"step-1-get-subscription-detail-configuration",level:2},{value:"1. <strong>Get Subscription Detail URL</strong>",id:"1-get-subscription-detail-url",level:3},{value:"2. <strong>Headers (Optional)</strong>",id:"2-headers-optional",level:3},{value:"3. <strong>Parameters</strong>",id:"3-parameters",level:3},{value:"4. <strong>Verify API</strong>",id:"4-verify-api",level:3},{value:"5. <strong>Response</strong>",id:"5-response",level:3},{value:"Step 2: Cancel Subscription Configuration",id:"step-2-cancel-subscription-configuration",level:2},{value:"1. <strong>Cancel Subscription URL</strong>",id:"1-cancel-subscription-url",level:3},{value:"2. <strong>Headers (Optional)</strong>",id:"2-headers-optional-1",level:3},{value:"3. <strong>Parameters</strong>",id:"3-parameters-1",level:3},{value:"4. <strong>Verify API</strong>",id:"4-verify-api-1",level:3},{value:"5. <strong>Response</strong>",id:"5-response-1",level:3},{value:"Step 3: Update Subscription Configuration",id:"step-3-update-subscription-configuration",level:2},{value:"1. <strong>Update Subscription Url</strong>",id:"1-update-subscription-url",level:3},{value:"2. <strong>Headers (Optional)</strong>",id:"2-headers-optional-2",level:3},{value:"3. <strong>Parameters</strong>",id:"3-parameters-2",level:3},{value:"4. <strong>Verify API</strong>",id:"4-verify-api-2",level:3},{value:"5. <strong>Response</strong>",id:"5-response-2",level:3}];function d(e){const n={code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"3rd-party-payment---subscription-management",children:"3rd Party Payment - Subscription Management"})}),"\n",(0,r.jsx)(n.h2,{id:"step-1-get-subscription-detail-configuration",children:"Step 1: Get Subscription Detail Configuration"}),"\n",(0,r.jsxs)(n.h3,{id:"1-get-subscription-detail-url",children:["1. ",(0,r.jsx)(n.strong,{children:"Get Subscription Detail URL"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:'Enter the get subscription detail url in the "Subscription Detail Url" field. This is the endpoint for sending requests to get the current subscription details.'}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"2-headers-optional",children:["2. ",(0,r.jsx)(n.strong,{children:"Headers (Optional)"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:'You can add any custom headers needed for your request by clicking the "+ Add Header" button. This can be useful if the API you\'re using requires authentication or other header-based configurations.'}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"3-parameters",children:["3. ",(0,r.jsx)(n.strong,{children:"Parameters"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"The configuration requires several parameters to be passed:"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "OrderID": "1234567890"\n}\n'})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"OrderID:"})," The unique ID for the order (e.g., 1234567890)."]}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"4-verify-api",children:["4. ",(0,r.jsx)(n.strong,{children:"Verify API"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:'After entering the get subscription detail url and parameters, click the "Verify API" button to check the configuration and initiate the verification.'}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"5-response",children:["5. ",(0,r.jsx)(n.strong,{children:"Response"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Once the request is processed, the system expects a response in the following format:"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "Data": [{}],\n "Version": "1.0.0",\n "Success": true,\n "Code": 200,\n "Message": ""\n}\n'})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Data:"})," Subscription info array."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Success:"})," A boolean indicating whether the payment process was successful."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Code:"})," The response code, 200 means success."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Message:"})," A message, typically left empty if successful."]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"step-2-cancel-subscription-configuration",children:"Step 2: Cancel Subscription Configuration"}),"\n",(0,r.jsxs)(n.h3,{id:"1-cancel-subscription-url",children:["1. ",(0,r.jsx)(n.strong,{children:"Cancel Subscription URL"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:'Enter the cancel subscription url in the "Cancel Subscription Url" field. This is the endpoint for sending requests to cancel the subscription.'}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"2-headers-optional-1",children:["2. ",(0,r.jsx)(n.strong,{children:"Headers (Optional)"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:'You can add any custom headers needed for your request by clicking the "+ Add Header" button. This can be useful if the API you\'re using requires authentication or other header-based configurations.'}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"3-parameters-1",children:["3. ",(0,r.jsx)(n.strong,{children:"Parameters"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"The configuration requires several parameters to be passed:"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "SubscriptionID": "1234567890",\n "CancelAtPeriodEnd": true\n}\n'})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"SubscriptionID:"})," The unique ID of the subscription (e.g., 100001)."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"CancelAtPeriodEnd:"})," The cancel at period end for the subscription (e.g., true)."]}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"4-verify-api-1",children:["4. ",(0,r.jsx)(n.strong,{children:"Verify API"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:'After entering the cancel subscription URL and parameters, click the "Verify API" button to check the configuration and initiate the verification.'}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"5-response-1",children:["5. ",(0,r.jsx)(n.strong,{children:"Response"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Once the request is processed, the system expects a response in the following format:"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "Data": {},\n "Version": "1.0.0",\n "Success": true,\n "Code": 200,\n "Message": ""\n}\n'})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Data:"})," Subscription info."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Success:"})," A boolean indicating whether the payment process was successful."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Code:"})," The response code, 200 means success."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Message:"})," A message, typically left empty if successful."]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"step-3-update-subscription-configuration",children:"Step 3: Update Subscription Configuration"}),"\n",(0,r.jsxs)(n.h3,{id:"1-update-subscription-url",children:["1. ",(0,r.jsx)(n.strong,{children:"Update Subscription Url"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:'Enter the update subscription url in the "Update Subscription Url" field. This is the endpoint for sending requests to update the subscription.'}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"2-headers-optional-2",children:["2. ",(0,r.jsx)(n.strong,{children:"Headers (Optional)"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:'You can add any custom headers needed for your request by clicking the "+ Add Header" button. This can be useful if the API you\'re using requires authentication or other header-based configurations.'}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"3-parameters-2",children:["3. ",(0,r.jsx)(n.strong,{children:"Parameters"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"The configuration requires several parameters to be passed"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "OrderID": "1234567890",\n "SubscriptionID": "1234567890",\n "LookupKey": "test",\n "ProrationDate": "1739525077"\n}\n'})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"OrderID:"})," WhiteLabel site order ID (e.g., 1234567890)."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"SubscriptionID:"})," 3rd party payment subscription ID (e.g., 1234567890)."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"LookupKey:"})," price lookupkey (e.g., test)."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"ProrationDate:"})," Current time stamp (e.g., 1739525077)."]}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"4-verify-api-2",children:["4. ",(0,r.jsx)(n.strong,{children:"Verify API"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:'After entering the update subscription url and parameters, click the "Verify API" button to check the configuration and initiate the verification.'}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"5-response-2",children:["5. ",(0,r.jsx)(n.strong,{children:"Response"})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Once the payment request is processed, the system expects a response in the following format:"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "Data": {},\n "Version": "1.0.0",\n "Success": true,\n "Code": 200,\n "Message": ""\n}\n'})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Data:"})," Subscription info."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Success:"})," A boolean indicating whether the payment process was successful."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Code:"})," The response code, 200 means success."]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Message:"})," A message, typically left empty if successful."]}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},767:(e,n,s)=>{s.d(n,{Ay:()=>g,NH:()=>p,TM:()=>l,VQ:()=>d,iW:()=>c,r3:()=>h,zV:()=>u});s(6540);var t=s(3532),r=s(8069),i=s(9303),o=s(4848);const a=function(e,n){void 0===n&&(n={});const s=JSON.stringify(e,null,2).split("\n"),t=[];return s.forEach((e=>{const s=e.match(/"([^"]+)":/);if(s&&n[s[1]]){const r=e.match(/^\s*/)?.[0]||"";t.push(`${r}// ${n[s[1]]}`)}t.push(e)})),t.join("\n")},l=e=>{let{path:n,method:s="POST"}=e;const r=(0,t.r)()(n)||`https://usapi.hottask.com${n}`;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("p",{children:[(0,o.jsx)("strong",{children:"Request URL:"})," ",r]}),(0,o.jsxs)("p",{children:[(0,o.jsx)("strong",{children:"Method:"})," ",s]})]})},c=e=>{let{headers:n={Authorization:"<Your-Secret-Key>","Content-Type":"application/json"},headersDescription:s={Authorization:"string, required - The secret key for authenticating the API request","Content-Type":"string, required - The content type of the request payload (must be application/json)"}}=e;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{children:"The API request must include the following headers:"}),(0,o.jsx)("ul",{children:Object.entries(n).map((e=>{let[n,t]=e;return(0,o.jsxs)("li",{children:[(0,o.jsxs)("code",{children:[n,": ",t]})," - ",s[n]]},n)}))})]})},d=e=>{let{requestBody:n,requestBodyParams:s,addCommentsToJson:t=a}=e;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{children:"The request body should contain the following parameters:"}),(0,o.jsx)(r.A,{language:"json",children:t(n,s)}),(0,o.jsx)("ul",{children:Object.entries(s).map((e=>{let[n,s]=e;return(0,o.jsxs)("li",{children:[(0,o.jsx)("code",{children:n})," - ",s]},n)}))})]})},h=e=>{let{method:n="POST",path:s,requestBody:a,headers:l={Authorization:"<Your-Secret-Key>","Content-Type":"application/json"}}=e;const c=(0,t.r)()(s),d="undefined"==typeof window?"usapi.hottask.com":new URL(c||`https://usapi.hottask.com${s}`).host,h={javascript:`const res = await fetch('${c||`https://usapi.hottask.com${s}`}', {\n method: '${n}',\n headers: ${JSON.stringify(l,null,2)},\n body: JSON.stringify(${JSON.stringify(a,null,2)})\n});\n\nconst data = await res.json();\nconsole.log(data);`,python:`import requests\nimport json\n\nurl = '${c||`https://usapi.hottask.com${s}`}'\nheaders = ${JSON.stringify(l,null,4)}\ndata = ${JSON.stringify(a,null,2)}\n\nresponse = requests.${n.toLowerCase()}(url, headers=headers, json=data)\ndata = response.json()\nprint(data)`,bash:`curl '${c||`https://usapi.hottask.com${s}`}' \\\n -X ${n} \\\n${Object.entries(l).map((e=>{let[n,s]=e;return` -H '${n}: ${s}' \\`})).join("\n")}\n -d '${JSON.stringify(a)}'`,http:`${n} ${s} HTTP/1.1\nHost: ${d}\n${Object.entries(l).map((e=>{let[n,s]=e;return`${n}: ${s}`})).join("\n")}\n\n${JSON.stringify(a,null,2)}`};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(i.A,{as:"h3",children:"JavaScript (Fetch API)"}),(0,o.jsx)(r.A,{language:"javascript",children:h.javascript}),(0,o.jsx)(i.A,{as:"h3",children:"Python (Requests Library)"}),(0,o.jsx)(r.A,{language:"python",children:h.python}),(0,o.jsx)(i.A,{as:"h3",children:"cURL"}),(0,o.jsx)(r.A,{language:"bash",children:h.bash}),(0,o.jsx)(i.A,{as:"h3",children:"HTTP Request"}),(0,o.jsx)(r.A,{language:"http",children:h.http})]})},u=e=>{let{responseExample:n,responseComments:s,addCommentsToJson:t=a}=e;const i={...n,Version:"1.0.0",Success:!0,Code:200,Message:""},l={...s,Version:"string - API version",Success:"boolean - Operation success status",Code:"integer - HTTP status code",Message:"string - Error message if any"};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{children:"The API response will be a JSON object with the following structure:"}),(0,o.jsx)(r.A,{language:"json",children:t(i,l)})]})},p=e=>{let{errorHandling:n="If the request fails, you should:\n1. Check the HTTP status code for network-level errors\n2. Examine the `Code` and `Message` fields in the response for business-level errors\n3. The `Message` field will contain detailed error information"}=e;return(0,o.jsx)("div",{style:{whiteSpace:"pre-line"},children:n})};function g(e){let{title:n,path:s,method:r="POST",description:i="",requestBody:g={timeZone:"Asia/Shanghai",type:0},requestBodyDescription:j={timeZone:"The time zone of the chatbot. The standard time zone format: e.g., Asia/Shanghai or America/New_York.",type:"Create a generic chatbot with a fixed value of 0"},requestBodyComments:x={timeZone:"string, required",type:"integer, required"},responseExample:m={Data:"3254a9d0424c4806b9ea3d0763xxxxxx",Version:"1.0.0",Success:!0,Code:200,Message:""},responseComments:f={Data:"chatbot id"},headers:y={Authorization:"<Your-Secret-Key>","Content-Type":"application/json"},headersDescription:b={Authorization:"The secret key for authenticating the API request.","Content-Type":"The content type of the request payload."},errorHandling:v="If it's an HTTP network error, you should check the `HTTP status code`. If it's a business exception, you need to examine the `Code` and `Message` fields, which will provide the error details."}=e;const S=(0,t.r)()(s),w="undefined"==typeof window?"usapi.hottask.com":new URL(S||`https://usapi.hottask.com${s}`).host;JSON.stringify(y,null,2),a(g,x),JSON.stringify(y,null,4),a(g,x),r.toLowerCase(),Object.entries(y).map((e=>{let[n,s]=e;return` -H '${n}: ${s}' \\`})).join("\n"),JSON.stringify(g),Object.entries(y).map((e=>{let[n,s]=e;return`${n}: ${s}`})).join("\n"),a(g,x);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(l,{path:s,method:r}),(0,o.jsx)(c,{headers:y,headersDescription:b}),(0,o.jsx)(d,{requestBody:g,requestBodyParams:j,addCommentsToJson:a}),(0,o.jsx)(h,{method:r,path:s,requestBody:g,headers:y}),(0,o.jsx)(u,{responseExample:m,responseComments:f,addCommentsToJson:a}),(0,o.jsx)(p,{errorHandling:v})]})}},8175:(e,n,s)=>{s.d(n,{A:()=>i});s(6540);var t=s(5872),r=s(4848);function i(){let e=(0,t.K)()();return["newoaks.ai","www.newoaks.ai","eu.newoaks.ai"].includes(e)&&(e="NewOaks AI"),"appointify.ai"===e&&(e="Appointify AI"),(0,r.jsx)("code",{children:e})}},9357:(e,n,s)=>{s.d(n,{A:()=>o});s(6540);var t=s(5872),r=s(5363),i=s(4848);function o(e){let{children:n}=e;return(0,i.jsx)(r.A,{children:()=>{const e=(0,t.K)()();if("function"==typeof n){const s=n(e);return(0,i.jsx)("div",{className:"markdown markdown--section",children:s})}return(0,i.jsx)("code",{children:e})}})}},3532:(e,n,s)=>{function t(){return function(e){if("undefined"==typeof window)return"";const n=window.location.hostname;let s="";return s="www.newoaks.ai"==n||"newoaks.ai"==n?"https://usapi.hottask.com":"eu.newoaks.ai"==n?"https://euapi.hottask.com":`https://${n}`,e?`${s}${e.startsWith("/")?e:`/${e}`}`:s}}s.d(n,{r:()=>t})},5872:(e,n,s)=>{function t(){return function(){return"undefined"==typeof window?"":window.location.hostname}}s.d(n,{K:()=>t})}}]);