1"use strict";(self.webpackChunkmia_platform_docs=self.webpackChunkmia_platform_docs||[]).push([["1195"],{807883(e,n,t){t.r(n),t.d(n,{metadata:()=>r,default:()=>p,frontMatter:()=>a,contentTitle:()=>l,toc:()=>c,assets:()=>d});var r=JSON.parse('{"id":"runtime-components/plugins/payment-gateway-manager/v2/stripe","title":"Stripe","description":"Starting a payment","source":"@site/versioned_docs/version-15.2.0/runtime-components/plugins/payment-gateway-manager/90_v2/95_stripe.md","sourceDirName":"runtime-components/plugins/payment-gateway-manager/90_v2","slug":"/runtime-components/plugins/payment-gateway-manager/v2/stripe","permalink":"/docs/15.2.0/runtime-components/plugins/payment-gateway-manager/v2/stripe","draft":false,"unlisted":false,"tags":[],"version":"15.2.0","sidebarPosition":95,"frontMatter":{"id":"stripe","title":"Stripe","sidebar_label":"Stripe"},"sidebar":"marketplace","previous":{"title":"Applepay","permalink":"/docs/15.2.0/runtime-components/plugins/payment-gateway-manager/v2/applepay"},"next":{"title":"Recurrent payments","permalink":"/docs/15.2.0/runtime-components/plugins/payment-gateway-manager/v2/recurrent_payments"}}'),i=t(474848),s=t(28453);let a={id:"stripe",title:"Stripe",sidebar_label:"Stripe"},l,d={},c=[{value:"Starting a payment",id:"starting-a-payment",level:2},{value:"One-Time",id:"one-time",level:3},{value:"Recurrent",id:"recurrent",level:3},{value:"Refund a payment",id:"refund-a-payment",level:2},{value:"Expire a Payment",id:"expire-a-payment",level:2},{value:"One-Time",id:"one-time-1",level:3},{value:"Recurrent",id:"recurrent-1",level:3}];function o(e){let n={a:"a",admonition:"admonition",br:"br",code:"code",h2:"h2",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",ul:"ul",...(0,s.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h2,{id:"starting-a-payment",children:"Starting a payment"}),"\n",(0,i.jsx)(n.h3,{id:"one-time",children:"One-Time"}),"\n",(0,i.jsxs)(n.p,{children:["Stripe ",(0,i.jsx)(n.code,{children:"/pay"})," request body has two required fields, they define the URLs where the user will be redirected in case of success or failure:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"lines",children:'{\n "successRedirect": "https://example.com/ok",\n "failureRedirect": "https://example.com/ko"\n}\n'})}),"\n",(0,i.jsx)(n.p,{children:"The previous body can be integrated using two different ways:"}),"\n",(0,i.jsxs)(n.ol,{children:["\n",(0,i.jsxs)(n.li,{children:["A simple Amount","\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"lines",children:'{\n "amount": "5.00"\n}\n'})}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["List of Products","\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"lines",children:'{\n "products": [...]\n}\n'})}),"\n","Three types of products are allowed:","\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["Price","\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"lines",children:'{\n "quantity": 1,\n "priceId": "price-id" \n}\n'})}),"\n","where ",(0,i.jsx)(n.code,{children:"priceId"})," refers to a Stripe ",(0,i.jsx)(n.a,{href:"https://stripe.com/docs/api/prices",children:"Price"})," object id."]}),"\n",(0,i.jsxs)(n.li,{children:["ProductId","\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"lines",children:'{\n "quantity": 2,\n "unitAmount": "1.00",\n "productId": "product-id" \n}\n'})}),"\n","where ",(0,i.jsx)(n.code,{children:"productId"})," refers to a Stripe ",(0,i.jsx)(n.a,{href:"https://stripe.com/docs/api/products",children:"Product"})," object id."]}),"\n",(0,i.jsxs)(n.li,{children:["ProductName","\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"lines",children:'{\n "quantity": 1,\n "unitAmount": "2.00",\n "productName": "product-name" \n}\n'})}),"\n"]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"recurrent",children:"Recurrent"}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"/pay/recurrent"})," request body has one more required field and one more optional field:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"lines",children:'{\n "interval": "day", // required\n "intervalCount": 10 // optional, default = 1\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["In the example above, the customer will be invoiced every ten days.\nPossible values for ",(0,i.jsx)(n.code,{children:"interval"})," are: day, week, month or year.\nThese two fields must be added in the Amount, ProductId and ProductName objects.",(0,i.jsx)(n.br,{}),"\n","By default, subscriptions do not end."]}),"\n",(0,i.jsx)(n.p,{children:"A complete example:"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"lines",children:'{\n "successRedirect": "https://example.com/ok",\n "failureRedirect": "https://example.com/ko",\n "products": [\n {\n "unitAmou
1nt": "7.50",\n "quantity": 1,\n "productName": "product-name",\n "interval": "month",\n "intervalCount": 1\n },\n {\n "unitAmount": "7.50",\n "quantity": 1,\n "productId": "product-id",\n "interval": "month",\n "intervalCount": 1\n }\n ]\n}\n'})}),"\n",(0,i.jsx)(n.admonition,{type:"warning",children:(0,i.jsxs)(n.p,{children:["If more than a product is specified in the same request, they must have the same ",(0,i.jsx)(n.code,{children:"interval"})," and ",(0,i.jsx)(n.code,{children:"intervalCount"}),"."]})}),"\n",(0,i.jsx)(n.h2,{id:"refund-a-payment",children:"Refund a payment"}),"\n",(0,i.jsxs)(n.p,{children:["Stripe supports both full and partial refund. If no amount is specified in the request, a full refund is performed.",(0,i.jsx)(n.br,{}),"\n","The request body is:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"lines",children:'{\n "paymentID": "payment-id",\n "amount": "1.00" // optional\n}\n'})}),"\n",(0,i.jsx)(n.p,{children:"Stripe also supports multiple partial refund on the same payment, the sum of all the refunds must be less or equal to the total amount paid."}),"\n",(0,i.jsx)(n.h2,{id:"expire-a-payment",children:"Expire a Payment"}),"\n",(0,i.jsx)(n.h3,{id:"one-time-1",children:"One-Time"}),"\n",(0,i.jsxs)(n.p,{children:["Through the endpoint ",(0,i.jsx)(n.code,{children:"POST /pay/expire"})," is possible to mark as invalid a requested payment not already authorized by the customer.",(0,i.jsx)(n.br,{}),"\n","The request body is:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"lines",children:'{\n "paymentID": "payment-id"\n}\n'})}),"\n",(0,i.jsx)(n.h3,{id:"recurrent-1",children:"Recurrent"}),"\n",(0,i.jsxs)(n.p,{children:["The endpoint ",(0,i.jsx)(n.code,{children:"POST /pay/recurrent/expire"})," sets the date until a subscription remains active.",(0,i.jsx)(n.br,{}),"\n","The request body is:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-json",metastring:"lines",children:'{\n "paymentID": "payment-id",\n "cancelType": "atDay",\n "cancelTime": "31/12/2022"\n}\n'})}),"\n",(0,i.jsxs)(n.p,{children:["Possible values for ",(0,i.jsx)(n.code,{children:"cancelType"})," are:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:"now: immediately cancel the subscription"}),"\n",(0,i.jsx)(n.li,{children:"endOfPeriod: cancel the subscription right before the next renewal"}),"\n",(0,i.jsxs)(n.li,{children:["atDay: cancel the subscription at the day specified in the ",(0,i.jsx)(n.code,{children:"cancelTime"}),' field (format "dd/MM/YYYY")']}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["The ",(0,i.jsx)(n.code,{children:"cancelTime"})," field is required only for ",(0,i.jsx)(n.code,{children:'"cancelType": "atDay"'})," and must be in the format ",(0,i.jsx)(n.code,{children:"dd/MM/yyyy"}),"."]})]})}function p(e={}){let{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(o,{...e})}):o(e)}},28453(e,n,t){t.d(n,{R:()=>a,x:()=>l});var r=t(296540);let i={},s=r.createContext(i);function a(e){let n=r.useContext(s);return r.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:a(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.