{"id":614,"date":"2023-11-22T22:25:00","date_gmt":"2023-11-22T22:25:00","guid":{"rendered":"https:\/\/rishikantsri.in\/blog\/?p=614"},"modified":"2023-11-23T05:02:38","modified_gmt":"2023-11-23T05:02:38","slug":"laravel-8-x-optimizing-payment-flows-for-web-and-mobile-integration","status":"publish","type":"post","link":"https:\/\/rishikantsri.in\/blog\/laravel-8-x-optimizing-payment-flows-for-web-and-mobile-integration\/","title":{"rendered":"Laravel 8.x: Optimizing Payment Flows for Web and Mobile Integration"},"content":{"rendered":"\n<p>The approach depends on the specific requirements and constraints of your project. Here are some considerations and potential approaches:<\/p>\n\n\n\n<ol>\n<li><strong>Mobile SDK Integration<\/strong>: Some payment gateways offer mobile SDKs (Software Development Kits) specifically designed for mobile app integration. These SDKs can provide a more streamlined and native experience for mobile users. If your chosen payment gateway offers an SDK, consider using it to simplify the integration.<\/li>\n\n\n\n<li><strong>Hybrid Payment Flow<\/strong>: If you want to minimize the use of web views within the mobile app, you can implement a hybrid payment flow. In this approach, you provide a web-based payment form within the mobile app for users who prefer web payments. However, you also integrate native payment options or SDKs for a seamless mobile experience.<\/li>\n\n\n\n<li><strong>Custom API Integration<\/strong>: Instead of relying solely on a web view, you can implement custom API endpoints for your mobile app, allowing it to communicate directly with the payment gateway. This approach may require more development effort but can offer greater flexibility and control.<\/li>\n\n\n\n<li><strong>Progressive Web App (PWA)<\/strong>: If you want to provide a consistent payment experience across web and mobile, consider building a Progressive Web App. PWAs can be accessed from web browsers and installed on mobile devices, blurring the lines between web and mobile.<\/li>\n\n\n\n<li><strong>Decoupled or Headless CMS<\/strong>: If your web application and mobile app share a backend, you can implement a decoupled or headless CMS architecture. This allows you to manage content and products separately from the presentation layer, making it easier to serve content to different clients.<\/li>\n<\/ol>\n\n\n\n<p>Now. we had the latest scenario, in which we tried this solution.  <\/p>\n\n\n\n<ol>\n<li>Generate a unique code for each order made and store it in the order database.<\/li>\n\n\n\n<li>From the mobile app, select a payment method linked to that unique order code.<\/li>\n\n\n\n<li>Open a specific web page within the mobile app using the order code.<\/li>\n\n\n\n<li>Retrieve the order details in the backend using the code and complete the payment process.<\/li>\n<\/ol>\n\n\n\n<p>The scenario is described involves creating a unique order number, making a payment request from a mobile app, and then processing the payment based on the order number. This can be achieved in the following steps:<\/p>\n\n\n\n<ol>\n<li><strong>Generate a Unique Order Number<\/strong>: When creating an order, generate a unique order number, and save it to the order table. You can use Laravel&#8217;s built-in mechanisms to generate unique order numbers, such as using timestamps or UUIDs.<\/li>\n\n\n\n<li><strong>Mobile App Payment Request<\/strong>:In the mobile app, allow the user to select a payment gateway option and initiate a payment request. Send the payment request to your Laravel API, along with the unique order number.<\/li>\n\n\n\n<li><strong>Web View for Payment<\/strong>:In the mobile app&#8217;s web view, open a web page that contains the payment form for the selected payment gateway. Pass the unique order number as a parameter in the URL or as a hidden form field.<\/li>\n\n\n\n<li><strong>Controller to Process Payment<\/strong>:In your Laravel controller, receive the request containing the unique order number and other payment-related data from the mobile app&#8217;s web view. Retrieve the order data from the order table based on the unique order number.<\/li>\n\n\n\n<li><strong>Payment Processing<\/strong>: Once you have the order data and the payment-related information, proceed with the payment processing logic, including interacting with the chosen payment gateway. This might involve making API calls to the payment gateway to complete the payment.<\/li>\n<\/ol>\n\n\n\n<p>Here&#8217;s an example of how you can implement this in your Laravel controller:<\/p>\n\n\n\n<p>First, create a webpage URL, which will be shared with the Mobile app developer. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:1.125rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#b392f0;--cbp-line-number-width:19.80000114440918px;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1f1f1f\"><span style=\"background:#a37ced;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1f1f1f\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" data-code=\"use Illuminate\\Support\\Facades\\Route;\n\nRoute::get('\/confirmpaymnet\/{id}', function ($id) {\n    $csrfToken = csrf_token(); \/\/ Retrieve CSRF token\n\n    $content = &quot;\n        &lt;!DOCTYPE html&gt;\n        &lt;html&gt;\n        &lt;head&gt;\n            &lt;title&gt;Thank You&lt;\/title&gt;\n        &lt;\/head&gt;\n        &lt;body&gt;\n            &lt;h1&gt;Thank you, User #$id!&lt;\/h1&gt;\n            \n            &lt;form method='post' action='\/submit'&gt;\n                @csrf\n                &lt;input type='hidden' name='id' value='$id'&gt;\n                &lt;button type='submit'&gt;Submit&lt;\/button&gt;\n            &lt;\/form&gt;\n        &lt;\/body&gt;\n        &lt;\/html&gt;\n    &quot;;\n\n    return response($content, 200)-&gt;header('Content-Type', 'text\/html');\n});\n\n\/\/ Route for form submission\nRoute::post('\/submit', function (\\Illuminate\\Http\\Request $request) {\n    \/\/ Handle form submission here\n    $id = $request-&gt;input('id');\n    \/\/ Additional logic...\n    \/\/ redirect to payment process\n   \n});\n\" style=\"color:#b392f0;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki min-dark\" style=\"background-color: #1f1f1f\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">use<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #79B8FF\">Illuminate<\/span><span style=\"color: #BBBBBB\">\\<\/span><span style=\"color: #79B8FF\">Support<\/span><span style=\"color: #BBBBBB\">\\<\/span><span style=\"color: #79B8FF\">Facades<\/span><span style=\"color: #BBBBBB\">\\<\/span><span style=\"color: #79B8FF\">Route<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">Route<\/span><span style=\"color: #F97583\">::<\/span><span style=\"color: #B392F0\">get<\/span><span style=\"color: #BBBBBB\">(<\/span><span style=\"color: #FFAB70\">&#39;\/confirmpaymnet\/{id}&#39;<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">function<\/span><span style=\"color: #B392F0\"> ($id) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    $csrfToken <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> csrf_token<\/span><span style=\"color: #BBBBBB\">()<\/span><span style=\"color: #B392F0\">; <\/span><span style=\"color: #6B737C\">\/\/ Retrieve CSRF token<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    $content <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #FFAB70\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FFAB70\">        &lt;!DOCTYPE html&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FFAB70\">        &lt;html&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FFAB70\">        &lt;head&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FFAB70\">            &lt;title&gt;Thank You&lt;\/title&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FFAB70\">        &lt;\/head&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FFAB70\">        &lt;body&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FFAB70\">            &lt;h1&gt;Thank you, User #$id!&lt;\/h1&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FFAB70\">            <\/span><\/span>\n<span class=\"line\"><span style=\"color: #FFAB70\">            &lt;form method=&#39;post&#39; action=&#39;\/submit&#39;&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FFAB70\">                @csrf<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FFAB70\">                &lt;input type=&#39;hidden&#39; name=&#39;id&#39; value=&#39;$id&#39;&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FFAB70\">                &lt;button type=&#39;submit&#39;&gt;Submit&lt;\/button&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FFAB70\">            &lt;\/form&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FFAB70\">        &lt;\/body&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FFAB70\">        &lt;\/html&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #FFAB70\">    &quot;<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">return<\/span><span style=\"color: #B392F0\"> response<\/span><span style=\"color: #BBBBBB\">(<\/span><span style=\"color: #B392F0\">$content<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">200<\/span><span style=\"color: #BBBBBB\">)<\/span><span style=\"color: #F97583\">-&gt;<\/span><span style=\"color: #B392F0\">header<\/span><span style=\"color: #BBBBBB\">(<\/span><span style=\"color: #FFAB70\">&#39;Content-Type&#39;<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #FFAB70\">&#39;text\/html&#39;<\/span><span style=\"color: #BBBBBB\">)<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">}<\/span><span style=\"color: #BBBBBB\">)<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #6B737C\">\/\/ Route for form submission<\/span><\/span>\n<span class=\"line\"><span style=\"color: #79B8FF\">Route<\/span><span style=\"color: #F97583\">::<\/span><span style=\"color: #B392F0\">post<\/span><span style=\"color: #BBBBBB\">(<\/span><span style=\"color: #FFAB70\">&#39;\/submit&#39;<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">function<\/span><span style=\"color: #B392F0\"> (<\/span><span style=\"color: #BBBBBB\">\\<\/span><span style=\"color: #79B8FF\">Illuminate<\/span><span style=\"color: #BBBBBB\">\\<\/span><span style=\"color: #79B8FF\">Http<\/span><span style=\"color: #BBBBBB\">\\<\/span><span style=\"color: #79B8FF\">Request<\/span><span style=\"color: #B392F0\"> $request) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #6B737C\">\/\/ Handle form submission here<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    $id <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> $request<\/span><span style=\"color: #F97583\">-&gt;<\/span><span style=\"color: #B392F0\">input<\/span><span style=\"color: #BBBBBB\">(<\/span><span style=\"color: #FFAB70\">&#39;id&#39;<\/span><span style=\"color: #BBBBBB\">)<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #6B737C\">\/\/ Additional logic...<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #6B737C\">\/\/ redirect to payment process<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">   <\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">}<\/span><span style=\"color: #BBBBBB\">)<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:1.125rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#b392f0;--cbp-line-number-width:19.80000114440918px;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1f1f1f\"><span style=\"background:#a37ced;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1f1f1f\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;!DOCTYPE html&gt;\n&lt;html lang=&quot;en&quot;&gt;\n&lt;head&gt;\n  &lt;meta charset=&quot;UTF-8&quot;&gt;\n  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;\n  &lt;title&gt;TeleBirr Payment&lt;\/title&gt;\n  &lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot;&gt; &lt;!-- Link to your CSS file --&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n\n&lt;div class=&quot;container&quot;&gt;\n  &lt;p id=&quot;redirectMessage&quot; style=&quot;display: none;&quot;&gt;Redirecting you to Gateway Payment.&lt;\/p&gt;\n  &lt;p&gt;Please click on Process Button.&lt;\/p&gt;\n  &lt;p&gt;It may take some time.&lt;\/p&gt;\n  &lt;p&gt;Thanks.&lt;\/p&gt;\n\n  &lt;form id=&quot;paymentForm&quot; method='post' action='\/telebirr\/payment\/submit'&gt;\n    @csrf\n    &lt;input type='hidden' name='id' value=&quot;{{ $data['id'] }}&quot;&gt;\n    &lt;input type='hidden' name='order_id' value=&quot;{{ $data['order_id'] }}&quot;&gt;\n    &lt;input type='hidden' name='order_number' value=&quot;{{ $data['order_number'] }}&quot;&gt;\n    &lt;input type='hidden' name='cart_total' value=&quot;{{ $data['cart_total'] }}&quot;&gt;\n    &lt;button id=&quot;submitButton&quot; type='submit' onclick=&quot;handleSubmission(event)&quot;&gt;Proceed&lt;\/button&gt;\n  &lt;\/form&gt;\n&lt;\/div&gt;\n\n&lt;script&gt;\n  function handleSubmission(event) {\n    event.preventDefault(); \/\/ Prevents the default form submission behavior\n\n    const submitButton = document.getElementById('submitButton');\n    const redirectMessage = document.getElementById('redirectMessage');\n    const paymentForm = document.getElementById('paymentForm');\n\n    submitButton.style.display = 'none'; \/\/ Hides the submit button\n    redirectMessage.style.display = 'block'; \/\/ Shows the redirect message\n\n    setTimeout(function() {\n      paymentForm.submit(); \/\/ Submits the form after 2 seconds\n    }, 2000); \/\/ Adjust the delay as needed (in milliseconds)\n  }\n&lt;\/script&gt;\n\n&lt;\/body&gt;\n&lt;\/html&gt;\n\" style=\"color:#b392f0;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki min-dark\" style=\"background-color: #1f1f1f\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;!<\/span><span style=\"color: #B392F0\">DOCTYPE html<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">html lang<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&quot;en&quot;<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">head<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">meta charset<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&quot;UTF-8&quot;<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">meta name<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&quot;viewport&quot;<\/span><span style=\"color: #B392F0\"> content<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&quot;width=device-width, initial-scale=1.0&quot;<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">title<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #B392F0\">TeleBirr Payment<\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #B392F0\">title<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">link rel<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&quot;stylesheet&quot;<\/span><span style=\"color: #B392F0\"> href<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&quot;styles.css&quot;<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">&lt;!--<\/span><span style=\"color: #B392F0\"> Link to your CSS file <\/span><span style=\"color: #F97583\">--&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #B392F0\">head<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">body<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">div <\/span><span style=\"color: #F97583\">class=<\/span><span style=\"color: #FFAB70\">&quot;container&quot;<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">p id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&quot;redirectMessage&quot;<\/span><span style=\"color: #B392F0\"> style<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&quot;display: none;&quot;<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #B392F0\">Redirecting you to Gateway Payment<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #B392F0\">p<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">p<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #B392F0\">Please click <\/span><span style=\"color: #79B8FF\">on<\/span><span style=\"color: #B392F0\"> Process Button<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #B392F0\">p<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">p<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #B392F0\">It may take some time<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #B392F0\">p<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">p<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #B392F0\">Thanks<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #B392F0\">p<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">form id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&quot;paymentForm&quot;<\/span><span style=\"color: #B392F0\"> method<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&#39;post&#39;<\/span><span style=\"color: #B392F0\"> action<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&#39;\/telebirr\/payment\/submit&#39;<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">@<\/span><span style=\"color: #B392F0\">csrf<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">input type<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&#39;hidden&#39;<\/span><span style=\"color: #B392F0\"> name<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&#39;id&#39;<\/span><span style=\"color: #B392F0\"> value<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&quot;{{ $data[&#39;id&#39;] }}&quot;<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">input type<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&#39;hidden&#39;<\/span><span style=\"color: #B392F0\"> name<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&#39;order_id&#39;<\/span><span style=\"color: #B392F0\"> value<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&quot;{{ $data[&#39;order_id&#39;] }}&quot;<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">input type<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&#39;hidden&#39;<\/span><span style=\"color: #B392F0\"> name<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&#39;order_number&#39;<\/span><span style=\"color: #B392F0\"> value<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&quot;{{ $data[&#39;order_number&#39;] }}&quot;<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">input type<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&#39;hidden&#39;<\/span><span style=\"color: #B392F0\"> name<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&#39;cart_total&#39;<\/span><span style=\"color: #B392F0\"> value<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&quot;{{ $data[&#39;cart_total&#39;] }}&quot;<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">button id<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&quot;submitButton&quot;<\/span><span style=\"color: #B392F0\"> type<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&#39;submit&#39;<\/span><span style=\"color: #B392F0\"> onclick<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\">&quot;handleSubmission(event)&quot;<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #B392F0\">Proceed<\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #B392F0\">button<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  <\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #B392F0\">form<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #B392F0\">div<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #B392F0\">script<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  <\/span><span style=\"color: #F97583\">function<\/span><span style=\"color: #B392F0\"> handleSubmission(event) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    event<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #B392F0\">preventDefault<\/span><span style=\"color: #BBBBBB\">()<\/span><span style=\"color: #B392F0\">; <\/span><span style=\"color: #6B737C\">\/\/ Prevents the default form submission behavior<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">const<\/span><span style=\"color: #B392F0\"> submitButton <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> document<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #B392F0\">getElementById<\/span><span style=\"color: #BBBBBB\">(<\/span><span style=\"color: #FFAB70\">&#39;submitButton&#39;<\/span><span style=\"color: #BBBBBB\">)<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">const<\/span><span style=\"color: #B392F0\"> redirectMessage <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> document<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #B392F0\">getElementById<\/span><span style=\"color: #BBBBBB\">(<\/span><span style=\"color: #FFAB70\">&#39;redirectMessage&#39;<\/span><span style=\"color: #BBBBBB\">)<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">const<\/span><span style=\"color: #B392F0\"> paymentForm <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> document<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #B392F0\">getElementById<\/span><span style=\"color: #BBBBBB\">(<\/span><span style=\"color: #FFAB70\">&#39;paymentForm&#39;<\/span><span style=\"color: #BBBBBB\">)<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    submitButton<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #B392F0\">style<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #B392F0\">display <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #FFAB70\">&#39;none&#39;<\/span><span style=\"color: #B392F0\">; <\/span><span style=\"color: #6B737C\">\/\/ Hides the submit button<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    redirectMessage<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #B392F0\">style<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #B392F0\">display <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #FFAB70\">&#39;block&#39;<\/span><span style=\"color: #B392F0\">; <\/span><span style=\"color: #6B737C\">\/\/ Shows the redirect message<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    setTimeout<\/span><span style=\"color: #BBBBBB\">(<\/span><span style=\"color: #F97583\">function<\/span><span style=\"color: #B392F0\">() {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">      paymentForm<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #B392F0\">submit<\/span><span style=\"color: #BBBBBB\">()<\/span><span style=\"color: #B392F0\">; <\/span><span style=\"color: #6B737C\">\/\/ Submits the form after 2 seconds<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    }<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">2000<\/span><span style=\"color: #BBBBBB\">)<\/span><span style=\"color: #B392F0\">; <\/span><span style=\"color: #6B737C\">\/\/ Adjust the delay as needed (in milliseconds)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">  }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #B392F0\">script<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #B392F0\">body<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #B392F0\">html<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:1.125rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#b392f0;--cbp-line-number-width:19.80000114440918px;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1f1f1f\"><span style=\"background:#a37ced;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1f1f1f\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" data-code=\"public function processMobilePayment(Request $request)\n{\n    \/\/ Retrieve the unique order number from the request\n    $orderNumber = $request-&gt;input('order_number');\n\n    \/\/ Retrieve the order data based on the unique order number\n    $order = Order::where('order_number', $orderNumber)-&gt;first();\n\n    if ($order) {\n        \/\/ Process the payment using the payment gateway\n        $paymentGatewayResponse = $this-&gt;processPayment($order, $request-&gt;all());\n\n        \/\/ Update the order status or perform any necessary actions\n        $order-&gt;update([\n            'payment_status' =&gt; $paymentGatewayResponse-&gt;status,\n            \/\/ other order updates\n        ]);\n\n        \/\/ Return a response to the mobile app\n        return response()-&gt;json([\n            'message' =&gt; 'Payment processed successfully',\n            'order' =&gt; $order,\n            'payment_gateway_response' =&gt; $paymentGatewayResponse,\n        ]);\n    } else {\n        return response()-&gt;json([\n            'message' =&gt; 'Order not found or invalid order number',\n        ], 404);\n    }\n}\n\" style=\"color:#b392f0;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki min-dark\" style=\"background-color: #1f1f1f\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">public<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">function<\/span><span style=\"color: #B392F0\"> processMobilePayment(<\/span><span style=\"color: #79B8FF\">Request<\/span><span style=\"color: #B392F0\"> $request)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #6B737C\">\/\/ Retrieve the unique order number from the request<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    $orderNumber <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> $request<\/span><span style=\"color: #F97583\">-&gt;<\/span><span style=\"color: #B392F0\">input<\/span><span style=\"color: #BBBBBB\">(<\/span><span style=\"color: #FFAB70\">&#39;order_number&#39;<\/span><span style=\"color: #BBBBBB\">)<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #6B737C\">\/\/ Retrieve the order data based on the unique order number<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    $order <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #79B8FF\">Order<\/span><span style=\"color: #F97583\">::<\/span><span style=\"color: #B392F0\">where<\/span><span style=\"color: #BBBBBB\">(<\/span><span style=\"color: #FFAB70\">&#39;order_number&#39;<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> $orderNumber<\/span><span style=\"color: #BBBBBB\">)<\/span><span style=\"color: #F97583\">-&gt;<\/span><span style=\"color: #B392F0\">first<\/span><span style=\"color: #BBBBBB\">()<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    <\/span><span style=\"color: #F97583\">if<\/span><span style=\"color: #B392F0\"> ($order) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">        <\/span><span style=\"color: #6B737C\">\/\/ Process the payment using the payment gateway<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">        $paymentGatewayResponse <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #79B8FF\">$this<\/span><span style=\"color: #F97583\">-&gt;<\/span><span style=\"color: #B392F0\">processPayment<\/span><span style=\"color: #BBBBBB\">(<\/span><span style=\"color: #B392F0\">$order<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> $request<\/span><span style=\"color: #F97583\">-&gt;<\/span><span style=\"color: #B392F0\">all<\/span><span style=\"color: #BBBBBB\">())<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">        <\/span><span style=\"color: #6B737C\">\/\/ Update the order status or perform any necessary actions<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">        $order<\/span><span style=\"color: #F97583\">-&gt;<\/span><span style=\"color: #B392F0\">update<\/span><span style=\"color: #BBBBBB\">(<\/span><span style=\"color: #B392F0\">[<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">            <\/span><span style=\"color: #FFAB70\">&#39;payment_status&#39;<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">=&gt;<\/span><span style=\"color: #B392F0\"> $paymentGatewayResponse<\/span><span style=\"color: #F97583\">-&gt;<\/span><span style=\"color: #B392F0\">status<\/span><span style=\"color: #BBBBBB\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">            <\/span><span style=\"color: #6B737C\">\/\/ other order updates<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">        ]<\/span><span style=\"color: #BBBBBB\">)<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">        <\/span><span style=\"color: #6B737C\">\/\/ Return a response to the mobile app<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">        <\/span><span style=\"color: #F97583\">return<\/span><span style=\"color: #B392F0\"> response<\/span><span style=\"color: #BBBBBB\">()<\/span><span style=\"color: #F97583\">-&gt;<\/span><span style=\"color: #B392F0\">json<\/span><span style=\"color: #BBBBBB\">(<\/span><span style=\"color: #B392F0\">[<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">            <\/span><span style=\"color: #FFAB70\">&#39;message&#39;<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">=&gt;<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #FFAB70\">&#39;Payment processed successfully&#39;<\/span><span style=\"color: #BBBBBB\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">            <\/span><span style=\"color: #FFAB70\">&#39;order&#39;<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">=&gt;<\/span><span style=\"color: #B392F0\"> $order<\/span><span style=\"color: #BBBBBB\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">            <\/span><span style=\"color: #FFAB70\">&#39;payment_gateway_response&#39;<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">=&gt;<\/span><span style=\"color: #B392F0\"> $paymentGatewayResponse<\/span><span style=\"color: #BBBBBB\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">        ]<\/span><span style=\"color: #BBBBBB\">)<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    } <\/span><span style=\"color: #F97583\">else<\/span><span style=\"color: #B392F0\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">        <\/span><span style=\"color: #F97583\">return<\/span><span style=\"color: #B392F0\"> response<\/span><span style=\"color: #BBBBBB\">()<\/span><span style=\"color: #F97583\">-&gt;<\/span><span style=\"color: #B392F0\">json<\/span><span style=\"color: #BBBBBB\">(<\/span><span style=\"color: #B392F0\">[<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">            <\/span><span style=\"color: #FFAB70\">&#39;message&#39;<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F97583\">=&gt;<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #FFAB70\">&#39;Order not found or invalid order number&#39;<\/span><span style=\"color: #BBBBBB\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">        ]<\/span><span style=\"color: #BBBBBB\">,<\/span><span style=\"color: #B392F0\"> <\/span><span style=\"color: #F8F8F8\">404<\/span><span style=\"color: #BBBBBB\">)<\/span><span style=\"color: #B392F0\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">}<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p>In this example, the <code>processMobilePayment<\/code> method retrieves the order data based on the unique order number provided in the mobile app&#8217;s request. It then processes the payment and updates the order&#8217;s payment status. Finally, it returns a response to the mobile app with the payment status and any relevant data.<\/p>\n\n\n\n<p>Ensure that you have the necessary routes, views, and payment gateway integration set up in your Laravel application to support this flow. Additionally, handle error cases and validation as needed for a production-ready solution.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The approach depends on the specific requirements and constraints of your project. Here are some considerations and potential approaches: Now. we had the latest scenario, in which we tried this solution. The scenario is described involves creating a unique order number, making a payment request from a mobile app, and then processing the payment based [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[57,11],"tags":[3,86,4],"_links":{"self":[{"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/posts\/614"}],"collection":[{"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/comments?post=614"}],"version-history":[{"count":3,"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/posts\/614\/revisions"}],"predecessor-version":[{"id":619,"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/posts\/614\/revisions\/619"}],"wp:attachment":[{"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/media?parent=614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/categories?post=614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/tags?post=614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}