Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    buy now api

    General Discussion
    3
    10
    493
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      cmpengineers last edited by

      Dear all

      i want to make buy now also api so i can connected for mobile device ?

      how would i do it , just create new api route for the same controller buy now ?

      Screen Shot 2020-03-20 at 10.45.22 AM.png

      Best regards

      1 Reply Last reply Reply Quote 0
      • V
        Vaishali Agarwal last edited by

        Hi @cmpengineers

        currently Buy Now API is not implemented.
        You can create & implement by own as same like Add to cart API
        https://devdocs.bagisto.com/api_cart.html

        1 Reply Last reply Reply Quote 0
        • C
          cmpengineers last edited by

          Hi @Vaishali-Agarwal

          much appreciate for your fast response

          can you explain a little more in details " You can create & implement by own "

          you mean using the same cart controller ? and create an api for it ?

          i did not understand

          best regards

          1 Reply Last reply Reply Quote 0
          • V
            Vaishali Agarwal last edited by

            @cmpengineers

            You just need to call this api to adding product to cart https://github.com/bagisto/bagisto/blob/master/packages/Webkul/API/Http/routes.php#L252

            and send this argument with get request https://github.com/bagisto/bagisto/blob/master/packages/Webkul/API/Http/Controllers/Shop/CartController.php#L94

            once is_buy_now get request done, then Buy Now will be working.

            Thanks,

            C 1 Reply Last reply Reply Quote 0
            • C
              cmpengineers @Vaishali Agarwal last edited by cmpengineers

              @Vaishali-Agarwal said in buy now api:

              https://github.com/bagisto/bagisto/blob/master/packages/Webkul/API/Http/Controllers/Shop/CartController.php#L94

              Dear @Vaishali-Agarwal

              I'm trying to send the is_buy_now as get request how would I do it in postman

              is the key ? the is_buy_now and what about the value ? is the product id ?

              Screen Shot 2020-11-14 at 6.30.37 PM.png

              https://drov112dev.test/api/checkout/buy-now/cart/add/5?is_buy_now
              
              https://drov112dev.test/api/checkout/buy-now/cart/add/5?is_buy_now=5 
              
              https://drov112dev.test/api/checkout/buy-now/cart/add/?is_buy_now=5 
              
               Route::get('cart/add/{id}', 'CartController@store'); is this the correct API ? for buy now 
              

              please advise how to do the URL get with buy now

              regards

              1 Reply Last reply Reply Quote 0
              • C
                cmpengineers last edited by

                @Vaishali-Agarwal

                i did it but not sure if its the correct way i have created get API similar to

                when you pass is_buy_now as key right ? but what its the value should have ?

                Screen Shot 2020-11-15 at 2.39.03 PM.png

                  Route::post('cart/add/{id}', 'CartController@store');
                            
                  Route::get('cart/add/{id}','CartController@store');
                

                and for API URL

                https://drov112dev.test/api/checkout/cart/add/5/?product_id=5&is_buy_now=&quantity=50&customer_email=cmp@gmail.com
                

                but not sure if is_buy_now should contain a value also ?

                regards

                1 Reply Last reply Reply Quote 0
                • C
                  cmpengineers last edited by

                  @Vaishali-Agarwal

                  Hello is any one there ?

                  1 Reply Last reply Reply Quote 0
                  • C
                    cmpengineers last edited by

                    Hello there

                    1 Reply Last reply Reply Quote 0
                    • V
                      Vaishali Agarwal last edited by

                      @cmpengineers
                      allow me some time, i will update you.

                      Thanks

                      1 Reply Last reply Reply Quote 0
                      • V
                        vishalK last edited by vishalK

                        Hi @cmpengineers
                        From buy now api you mean when customer click on buy now so product added into cart and customer directly redirect to checkout or view cart page, please correct me if i am wrong.

                        So for this you have to do customisation in add to cart api.

                        1. First of all you need to pass is_buy_now in parameter with value true.
                        2. Now go to add to cart api controller here if condition is already there related to is_buy_now.
                        3. Now you need to add some custom parameter in return response so that you could identify that customer is using buy now btn instead of add to cart.
                        4. So at the last whenever you received your custom parameter in response so redirect the customer to the desired page.

                        You can implement this in both ways by adding new controller or modify existing add to cart controller.

                        Thanks

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post