"use strict";(self.webpackChunknewoaks_help=self.webpackChunknewoaks_help||[]).push([[4542],{7873:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>h,contentTitle:()=>d,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"custom-payment-integration","title":"White Label Payment Process - 3rd Party Payment","description":"To add a custom payment process follow these steps:","source":"@site/Integration/009.custom-payment-integration.md","sourceDirName":".","slug":"/custom-payment-integration","permalink":"/guides/integration/custom-payment-integration","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":9,"frontMatter":{"sidebar_position":9},"sidebar":"sidebar","previous":{"title":"Stripe Integration","permalink":"/guides/integration/stripe-active-pieces-integration"},"next":{"title":"3rd Party Payment - Subscription Management","permalink":"/guides/integration/custom-payment-subscription"}}');var r=n(4848),i=n(8453),o=n(767);n(9357),n(8175);const a={sidebar_position:9},d="White Label Payment Process - 3rd Party Payment",h={},c=[{value:"To add a custom payment process follow these steps:",id:"to-add-a-custom-payment-process-follow-these-steps",level:2},{value:"Endpoint",id:"endpoint",level:2},{value:"Request Headers",id:"request-headers",level:2},{value:"Request Body",id:"request-body",level:2},{value:"Example Request",id:"example-request",level:2},{value:"Response",id:"response",level:2},{value:"Error Handling",id:"error-handling",level:2}];function l(e){const t={br:"br",code:"code",h1:"h1",h2:"h2",header:"header",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.header,{children:(0,r.jsx)(t.h1,{id:"white-label-payment-process---3rd-party-payment",children:"White Label Payment Process - 3rd Party Payment"})}),"\n",(0,r.jsx)(t.h2,{id:"to-add-a-custom-payment-process-follow-these-steps",children:"To add a custom payment process follow these steps:"}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsx)(t.p,{children:"Log in to your Tier3 account."}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsx)(t.p,{children:"Once logged in, open your workspace"}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Navigate through White Label->Payment Settings\n",(0,r.jsx)(t.img,{src:n(7050).A+"",width:"1289",height:"641"})]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsx)(t.p,{children:"Payment Gateway Switch Options"}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsx)(t.li,{children:"AI Agent Automation Payment : Use the payment system provided by newoaks"}),"\n",(0,r.jsx)(t.li,{children:"3rd Party Payment: Using other third-party payment systems"}),"\n",(0,r.jsx)(t.li,{children:"No Payment: Hide Pricing in the Navigation Bar"}),"\n"]}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsx)(t.p,{children:"Select \u201c3rd Party Payment\u201d"}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsx)(t.p,{children:"Configure the request settings as needed. Fill in the necessary request information, including the URL, parameters, and authentication details."}),"\n",(0,r.jsx)(t.p,{children:"Call this api with the parameters OrderID, UserId, ProductName, Price, SuccessUrl, and CancelUrl. expect a response containing the payment page url and the OrderID."}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.strong,{children:"Tips:"})}),"\n",(0,r.jsxs)(t.p,{children:["Price is in cents.",(0,r.jsx)(t.br,{}),"\n","SuccessUrl is the URL to redirect to upon successful payment",(0,r.jsx)(t.br,{}),"\n","CancelUrl is the URL to redirect to if the payment is canceled."]}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.img,{src:n(9143).A+"",width:"911",height:"833"})}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsx)(t.p,{children:"Note that the response from this interface should follow the structure below."}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-JSON",children:'{\n "Data": {\n "URL": "https://checkout.stripe.com/xxxxxxxxxxxxx", // payment page url\n "OrderID": 1234567890\n },\n "Version": "1.0.0",\n "Success": true,\n "Code": 200,\n "Message": ""\n}\n'})}),"\n",(0,r.jsxs)(t.ol,{start:"10",children:["\n",(0,r.jsx)(t.li,{children:"Click the \u201cVerify Payment API\u201d button. If the interface operates correctly and returns the expected response, the validation will pass."}),"\n",(0,r.jsx)(t.li,{children:"Click the \u201cSave\u201d button."}),"\n",(0,r.jsx)(t.li,{children:"Go to your white label site Pricing page to make a purchase to verify that your configuration in the above steps is effective."}),"\n"]}),"\n",(0,r.jsx)(t.h1,{id:"payment-webhook-api",children:"Payment WebHook API"}),"\n",(0,r.jsx)(t.p,{children:"The webhook API should be notified every time a deduction is successful, both for the first successful subscription and for subsequent recurring automatic deductions."}),"\n",(0,r.jsx)(t.h2,{id:"endpoint",children:"Endpoint"}),"\n",(0,r.jsx)(o.TM,{apiUrl:"/chat/Chatbot/PaymentWebHook"}),"\n",(0,r.jsx)(t.h2,{id:"request-headers",children:"Request Headers"}),"\n",(0,r.jsx)(o.iW,{}),"\n",(0,r.jsx)(t.h2,{id:"request-body",children:"Request Body"}),"\n",(0,r.jsx)(o.VQ,{requestBody:{Type:"subscription_create",OrderID:"<The Order ID>",UserID:"<The order owner's ID>"},requestBodyParams:{Type:'string, required - Value should be one of ["subscription_create", "subscription_cycle"]. First subscription value is: "subscription_create", Renewal value is: "subscription_cycle"',OrderID:"int, required - Refers to the unique number of the order, this parameter has been passed to the other server when calling the Generate Payment Links API",UserID:"int, required - Refers to the unique number of the user of the order, this parameter has been passed to the other server when calling the Generate Payment Link API"}}),"\n",(0,r.jsx)(t.h2,{id:"example-request",children:"Example Request"}),"\n",(0,r.jsx)(o.r3,{method:"POST",path:"/chat/Chatbot/PaymentWebHook",requestBody:{Type:"subscription_create",OrderID:"<The Order ID>",UserID:"<The order owner's ID>"}}),"\n",(0,r.jsx)(t.h2,{id:"response",children:"Response"}),"\n",(0,r.jsx)(o.zV,{responseExample:{Data:"ok"},responseComments:{Data:"string - Response data"}}),"\n",(0,r.jsx)(t.h2,{id:"error-handling",children:"Error Handling"}),"\n",(0,r.jsx)(o.NH,{}),"\n",(0,r.jsx)(t.p,{children:"That's it! You should now be able to third party pay."})]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}},767:(e,t,n)=>{n.d(t,{Ay:()=>m,NH:()=>p,TM:()=>d,VQ:()=>c,iW:()=>h,r3:()=>l,zV:()=>u});n(6540);var s=n(3532),r=n(8069),i=n(9303),o=n(4848);const a=function(e,t){void 0===t&&(t={});const n=JSON.stringify(e,null,2).split("\n"),s=[];return n.forEach((e=>{const n=e.match(/"([^"]+)":/);if(n&&t[n[1]]){const r=e.match(/^\s*/)?.[0]||"";s.push(`${r}// ${t[n[1]]}`)}s.push(e)})),s.join("\n")},d=e=>{let{path:t,method:n="POST"}=e;const r=(0,s.r)()(t)||`https://usapi.hottask.com${t}`;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:"})," ",n]})]})},h=e=>{let{headers:t={Authorization:"<Your-Secret-Key>","Content-Type":"application/json"},headersDescription:n={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(t).map((e=>{let[t,s]=e;return(0,o.jsxs)("li",{children:[(0,o.jsxs)("code",{children:[t,": ",s]})," - ",n[t]]},t)}))})]})},c=e=>{let{requestBody:t,requestBodyParams:n,addCommentsToJson:s=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:s(t,n)}),(0,o.jsx)("ul",{children:Object.entries(n).map((e=>{let[t,n]=e;return(0,o.jsxs)("li",{children:[(0,o.jsx)("code",{children:t})," - ",n]},t)}))})]})},l=e=>{let{method:t="POST",path:n,requestBody:a,headers:d={Authorization:"<Your-Secret-Key>","Content-Type":"application/json"}}=e;const h=(0,s.r)()(n),c="undefined"==typeof window?"usapi.hottask.com":new URL(h||`https://usapi.hottask.com${n}`).host,l={javascript:`const res = await fetch('${h||`https://usapi.hottask.com${n}`}', {\n method: '${t}',\n headers: ${JSON.stringify(d,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 = '${h||`https://usapi.hottask.com${n}`}'\nheaders = ${JSON.stringify(d,null,4)}\ndata = ${JSON.stringify(a,null,2)}\n\nresponse = requests.${t.toLowerCase()}(url, headers=headers, json=data)\ndata = response.json()\nprint(data)`,bash:`curl '${h||`https://usapi.hottask.com${n}`}' \\\n -X ${t} \\\n${Object.entries(d).map((e=>{let[t,n]=e;return` -H '${t}: ${n}' \\`})).join("\n")}\n -d '${JSON.stringify(a)}'`,http:`${t} ${n} HTTP/1.1\nHost: ${c}\n${Object.entries(d).map((e=>{let[t,n]=e;return`${t}: ${n}`})).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:l.javascript}),(0,o.jsx)(i.A,{as:"h3",children:"Python (Requests Library)"}),(0,o.jsx)(r.A,{language:"python",children:l.python}),(0,o.jsx)(i.A,{as:"h3",children:"cURL"}),(0,o.jsx)(r.A,{language:"bash",children:l.bash}),(0,o.jsx)(i.A,{as:"h3",children:"HTTP Request"}),(0,o.jsx)(r.A,{language:"http",children:l.http})]})},u=e=>{let{responseExample:t,responseComments:n,addCommentsToJson:s=a}=e;const i={...t,Version:"1.0.0",Success:!0,Code:200,Message:""},d={...n,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:s(i,d)})]})},p=e=>{let{errorHandling:t="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:t})};function m(e){let{title:t,path:n,method:r="POST",description:i="",requestBody:m={timeZone:"Asia/Shanghai",type:0},requestBodyDescription:y={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:j={Data:"3254a9d0424c4806b9ea3d0763xxxxxx",Version:"1.0.0",Success:!0,Code:200,Message:""},responseComments:g={Data:"chatbot id"},headers:f={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:w="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 P=(0,s.r)()(n),T="undefined"==typeof window?"usapi.hottask.com":new URL(P||`https://usapi.hottask.com${n}`).host;JSON.stringify(f,null,2),a(m,x),JSON.stringify(f,null,4),a(m,x),r.toLowerCase(),Object.entries(f).map((e=>{let[t,n]=e;return` -H '${t}: ${n}' \\`})).join("\n"),JSON.stringify(m),Object.entries(f).map((e=>{let[t,n]=e;return`${t}: ${n}`})).join("\n"),a(m,x);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(d,{path:n,method:r}),(0,o.jsx)(h,{headers:f,headersDescription:b}),(0,o.jsx)(c,{requestBody:m,requestBodyParams:y,addCommentsToJson:a}),(0,o.jsx)(l,{method:r,path:n,requestBody:m,headers:f}),(0,o.jsx)(u,{responseExample:j,responseComments:g,addCommentsToJson:a}),(0,o.jsx)(p,{errorHandling:w})]})}},8175:(e,t,n)=>{n.d(t,{A:()=>i});n(6540);var s=n(5872),r=n(4848);function i(){let e=(0,s.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,t,n)=>{n.d(t,{A:()=>o});n(6540);var s=n(5872),r=n(5363),i=n(4848);function o(e){let{children:t}=e;return(0,i.jsx)(r.A,{children:()=>{const e=(0,s.K)()();if("function"==typeof t){const n=t(e);return(0,i.jsx)("div",{className:"markdown markdown--section",children:n})}return(0,i.jsx)("code",{children:e})}})}},3532:(e,t,n)=>{function s(){return function(e){if("undefined"==typeof window)return"";const t=window.location.hostname;let n="";return n="www.newoaks.ai"==t||"newoaks.ai"==t?"https://usapi.hottask.com":"eu.newoaks.ai"==t?"https://euapi.hottask.com":`https://${t}`,e?`${n}${e.startsWith("/")?e:`/${e}`}`:n}}n.d(t,{r:()=>s})},5872:(e,t,n)=>{function s(){return function(){return"undefined"==typeof window?"":window.location.hostname}}n.d(t,{K:()=>s})},7050:(e,t,n)=>{n.d(t,{A:()=>s});const s=n.p+"assets/images/custompay-step3-42384b08fb793d9edb53acaa85be6310.png"},9143:(e,t,n)=>{n.d(t,{A:()=>s});const s=n.p+"assets/images/custompay-step6-afb24d8d31e1e8678580dadd8ab85f41.png"}}]);