How to capture creditcard payment using sales order REST API magento 2?












4















How to create sales order with payflow pro payment using REST api magento 2.



Order placed successfully with sales order api but payment doesn't not set using order api.



I want to pass test credit card info in order to check how payment are capture using api.



Just test with VISA Test credit card




  • Credit card number 4111111111111111

  • Expiry Month year 01/20



Payment method is payflowpro.




Request:



http://{websiteurl}/index.php/rest/V1/orders/


I am using salesOrderRepositoryV1 API for place order using api from swagger Sales Order Using Rest API.



Below is the structure of payment method in api,



"payment": {
"account_status": "string",
"additional_data": "string",
"additional_information": [
"string"
],
"address_status": "string",
"amount_authorized": 0,
"amount_canceled": 0,
"amount_ordered": 0,
"amount_paid": 0,
"amount_refunded": 0,
"anet_trans_method": "string",
"base_amount_authorized": 0,
"base_amount_canceled": 0,
"base_amount_ordered": 0,
"base_amount_paid": 0,
"base_amount_paid_online": 0,
"base_amount_refunded": 0,
"base_amount_refunded_online": 0,
"base_shipping_amount": 0,
"base_shipping_captured": 0,
"base_shipping_refunded": 0,
"cc_approval": "string",
"cc_avs_status": "string",
"cc_cid_status": "string",
"cc_debug_request_body": "string",
"cc_debug_response_body": "string",
"cc_debug_response_serialized": "string",
"cc_exp_month": "string",
"cc_exp_year": "string",
"cc_last4": "string",
"cc_number_enc": "string",
"cc_owner": "string",
"cc_secure_verify": "string",
"cc_ss_issue": "string",
"cc_ss_start_month": "string",
"cc_ss_start_year": "string",
"cc_status": "string",
"cc_status_description": "string",
"cc_trans_id": "string",
"cc_type": "string",
"echeck_account_name": "string",
"echeck_account_type": "string",
"echeck_bank_name": "string",
"echeck_routing_number": "string",
"echeck_type": "string",
"entity_id": 0,
"last_trans_id": "string",
"method": "string",
"parent_id": 0,
"po_number": "string",
"protection_eligibility": "string",
"quote_payment_id": 0,
"shipping_amount": 0,
"shipping_captured": 0,
"shipping_refunded": 0,
"extension_attributes": {
"vault_payment_token": {
"entity_id": 0,
"customer_id": 0,
"public_hash": "string",
"payment_method_code": "string",
"type": "string",
"created_at": "string",
"expires_at": "string",
"gateway_token": "string",
"token_details": "string",
"is_active": true,
"is_visible": true
}
}
}


How to set credit card info in above structure to place order using Paypal.



How to place order using credit card data?










share|improve this question

























  • Did you get the solution Rakesh?

    – Keyur Shah
    Dec 4 '17 at 14:49











  • @rakesh Did you find any solution for this?? have u place an order using API.

    – Ketan Panchal
    Aug 29 '18 at 9:01











  • @KetanPanchal Not yet.

    – Rakesh Jesadiya
    Aug 29 '18 at 16:40











  • you can not you have to process the payment through paypal, hold the txn and correlation id and then pass these through additional_information. this goes for any offsite payment method

    – TTech IT Solutions
    Aug 29 '18 at 19:14











  • @TTechITSolutions Did u know which parameter we can pass through Payflow pro using API?? I have sent below request parameter and getting an error magento.stackexchange.com/questions/239676/…

    – Ketan Panchal
    Aug 30 '18 at 4:07


















4















How to create sales order with payflow pro payment using REST api magento 2.



Order placed successfully with sales order api but payment doesn't not set using order api.



I want to pass test credit card info in order to check how payment are capture using api.



Just test with VISA Test credit card




  • Credit card number 4111111111111111

  • Expiry Month year 01/20



Payment method is payflowpro.




Request:



http://{websiteurl}/index.php/rest/V1/orders/


I am using salesOrderRepositoryV1 API for place order using api from swagger Sales Order Using Rest API.



Below is the structure of payment method in api,



"payment": {
"account_status": "string",
"additional_data": "string",
"additional_information": [
"string"
],
"address_status": "string",
"amount_authorized": 0,
"amount_canceled": 0,
"amount_ordered": 0,
"amount_paid": 0,
"amount_refunded": 0,
"anet_trans_method": "string",
"base_amount_authorized": 0,
"base_amount_canceled": 0,
"base_amount_ordered": 0,
"base_amount_paid": 0,
"base_amount_paid_online": 0,
"base_amount_refunded": 0,
"base_amount_refunded_online": 0,
"base_shipping_amount": 0,
"base_shipping_captured": 0,
"base_shipping_refunded": 0,
"cc_approval": "string",
"cc_avs_status": "string",
"cc_cid_status": "string",
"cc_debug_request_body": "string",
"cc_debug_response_body": "string",
"cc_debug_response_serialized": "string",
"cc_exp_month": "string",
"cc_exp_year": "string",
"cc_last4": "string",
"cc_number_enc": "string",
"cc_owner": "string",
"cc_secure_verify": "string",
"cc_ss_issue": "string",
"cc_ss_start_month": "string",
"cc_ss_start_year": "string",
"cc_status": "string",
"cc_status_description": "string",
"cc_trans_id": "string",
"cc_type": "string",
"echeck_account_name": "string",
"echeck_account_type": "string",
"echeck_bank_name": "string",
"echeck_routing_number": "string",
"echeck_type": "string",
"entity_id": 0,
"last_trans_id": "string",
"method": "string",
"parent_id": 0,
"po_number": "string",
"protection_eligibility": "string",
"quote_payment_id": 0,
"shipping_amount": 0,
"shipping_captured": 0,
"shipping_refunded": 0,
"extension_attributes": {
"vault_payment_token": {
"entity_id": 0,
"customer_id": 0,
"public_hash": "string",
"payment_method_code": "string",
"type": "string",
"created_at": "string",
"expires_at": "string",
"gateway_token": "string",
"token_details": "string",
"is_active": true,
"is_visible": true
}
}
}


How to set credit card info in above structure to place order using Paypal.



How to place order using credit card data?










share|improve this question

























  • Did you get the solution Rakesh?

    – Keyur Shah
    Dec 4 '17 at 14:49











  • @rakesh Did you find any solution for this?? have u place an order using API.

    – Ketan Panchal
    Aug 29 '18 at 9:01











  • @KetanPanchal Not yet.

    – Rakesh Jesadiya
    Aug 29 '18 at 16:40











  • you can not you have to process the payment through paypal, hold the txn and correlation id and then pass these through additional_information. this goes for any offsite payment method

    – TTech IT Solutions
    Aug 29 '18 at 19:14











  • @TTechITSolutions Did u know which parameter we can pass through Payflow pro using API?? I have sent below request parameter and getting an error magento.stackexchange.com/questions/239676/…

    – Ketan Panchal
    Aug 30 '18 at 4:07
















4












4








4


1






How to create sales order with payflow pro payment using REST api magento 2.



Order placed successfully with sales order api but payment doesn't not set using order api.



I want to pass test credit card info in order to check how payment are capture using api.



Just test with VISA Test credit card




  • Credit card number 4111111111111111

  • Expiry Month year 01/20



Payment method is payflowpro.




Request:



http://{websiteurl}/index.php/rest/V1/orders/


I am using salesOrderRepositoryV1 API for place order using api from swagger Sales Order Using Rest API.



Below is the structure of payment method in api,



"payment": {
"account_status": "string",
"additional_data": "string",
"additional_information": [
"string"
],
"address_status": "string",
"amount_authorized": 0,
"amount_canceled": 0,
"amount_ordered": 0,
"amount_paid": 0,
"amount_refunded": 0,
"anet_trans_method": "string",
"base_amount_authorized": 0,
"base_amount_canceled": 0,
"base_amount_ordered": 0,
"base_amount_paid": 0,
"base_amount_paid_online": 0,
"base_amount_refunded": 0,
"base_amount_refunded_online": 0,
"base_shipping_amount": 0,
"base_shipping_captured": 0,
"base_shipping_refunded": 0,
"cc_approval": "string",
"cc_avs_status": "string",
"cc_cid_status": "string",
"cc_debug_request_body": "string",
"cc_debug_response_body": "string",
"cc_debug_response_serialized": "string",
"cc_exp_month": "string",
"cc_exp_year": "string",
"cc_last4": "string",
"cc_number_enc": "string",
"cc_owner": "string",
"cc_secure_verify": "string",
"cc_ss_issue": "string",
"cc_ss_start_month": "string",
"cc_ss_start_year": "string",
"cc_status": "string",
"cc_status_description": "string",
"cc_trans_id": "string",
"cc_type": "string",
"echeck_account_name": "string",
"echeck_account_type": "string",
"echeck_bank_name": "string",
"echeck_routing_number": "string",
"echeck_type": "string",
"entity_id": 0,
"last_trans_id": "string",
"method": "string",
"parent_id": 0,
"po_number": "string",
"protection_eligibility": "string",
"quote_payment_id": 0,
"shipping_amount": 0,
"shipping_captured": 0,
"shipping_refunded": 0,
"extension_attributes": {
"vault_payment_token": {
"entity_id": 0,
"customer_id": 0,
"public_hash": "string",
"payment_method_code": "string",
"type": "string",
"created_at": "string",
"expires_at": "string",
"gateway_token": "string",
"token_details": "string",
"is_active": true,
"is_visible": true
}
}
}


How to set credit card info in above structure to place order using Paypal.



How to place order using credit card data?










share|improve this question
















How to create sales order with payflow pro payment using REST api magento 2.



Order placed successfully with sales order api but payment doesn't not set using order api.



I want to pass test credit card info in order to check how payment are capture using api.



Just test with VISA Test credit card




  • Credit card number 4111111111111111

  • Expiry Month year 01/20



Payment method is payflowpro.




Request:



http://{websiteurl}/index.php/rest/V1/orders/


I am using salesOrderRepositoryV1 API for place order using api from swagger Sales Order Using Rest API.



Below is the structure of payment method in api,



"payment": {
"account_status": "string",
"additional_data": "string",
"additional_information": [
"string"
],
"address_status": "string",
"amount_authorized": 0,
"amount_canceled": 0,
"amount_ordered": 0,
"amount_paid": 0,
"amount_refunded": 0,
"anet_trans_method": "string",
"base_amount_authorized": 0,
"base_amount_canceled": 0,
"base_amount_ordered": 0,
"base_amount_paid": 0,
"base_amount_paid_online": 0,
"base_amount_refunded": 0,
"base_amount_refunded_online": 0,
"base_shipping_amount": 0,
"base_shipping_captured": 0,
"base_shipping_refunded": 0,
"cc_approval": "string",
"cc_avs_status": "string",
"cc_cid_status": "string",
"cc_debug_request_body": "string",
"cc_debug_response_body": "string",
"cc_debug_response_serialized": "string",
"cc_exp_month": "string",
"cc_exp_year": "string",
"cc_last4": "string",
"cc_number_enc": "string",
"cc_owner": "string",
"cc_secure_verify": "string",
"cc_ss_issue": "string",
"cc_ss_start_month": "string",
"cc_ss_start_year": "string",
"cc_status": "string",
"cc_status_description": "string",
"cc_trans_id": "string",
"cc_type": "string",
"echeck_account_name": "string",
"echeck_account_type": "string",
"echeck_bank_name": "string",
"echeck_routing_number": "string",
"echeck_type": "string",
"entity_id": 0,
"last_trans_id": "string",
"method": "string",
"parent_id": 0,
"po_number": "string",
"protection_eligibility": "string",
"quote_payment_id": 0,
"shipping_amount": 0,
"shipping_captured": 0,
"shipping_refunded": 0,
"extension_attributes": {
"vault_payment_token": {
"entity_id": 0,
"customer_id": 0,
"public_hash": "string",
"payment_method_code": "string",
"type": "string",
"created_at": "string",
"expires_at": "string",
"gateway_token": "string",
"token_details": "string",
"is_active": true,
"is_visible": true
}
}
}


How to set credit card info in above structure to place order using Paypal.



How to place order using credit card data?







magento-2.1 sales-order paypal-payflow-pro rest-api






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 29 '18 at 16:40







Rakesh Jesadiya

















asked Aug 12 '17 at 7:23









Rakesh JesadiyaRakesh Jesadiya

28.7k1571119




28.7k1571119













  • Did you get the solution Rakesh?

    – Keyur Shah
    Dec 4 '17 at 14:49











  • @rakesh Did you find any solution for this?? have u place an order using API.

    – Ketan Panchal
    Aug 29 '18 at 9:01











  • @KetanPanchal Not yet.

    – Rakesh Jesadiya
    Aug 29 '18 at 16:40











  • you can not you have to process the payment through paypal, hold the txn and correlation id and then pass these through additional_information. this goes for any offsite payment method

    – TTech IT Solutions
    Aug 29 '18 at 19:14











  • @TTechITSolutions Did u know which parameter we can pass through Payflow pro using API?? I have sent below request parameter and getting an error magento.stackexchange.com/questions/239676/…

    – Ketan Panchal
    Aug 30 '18 at 4:07





















  • Did you get the solution Rakesh?

    – Keyur Shah
    Dec 4 '17 at 14:49











  • @rakesh Did you find any solution for this?? have u place an order using API.

    – Ketan Panchal
    Aug 29 '18 at 9:01











  • @KetanPanchal Not yet.

    – Rakesh Jesadiya
    Aug 29 '18 at 16:40











  • you can not you have to process the payment through paypal, hold the txn and correlation id and then pass these through additional_information. this goes for any offsite payment method

    – TTech IT Solutions
    Aug 29 '18 at 19:14











  • @TTechITSolutions Did u know which parameter we can pass through Payflow pro using API?? I have sent below request parameter and getting an error magento.stackexchange.com/questions/239676/…

    – Ketan Panchal
    Aug 30 '18 at 4:07



















Did you get the solution Rakesh?

– Keyur Shah
Dec 4 '17 at 14:49





Did you get the solution Rakesh?

– Keyur Shah
Dec 4 '17 at 14:49













@rakesh Did you find any solution for this?? have u place an order using API.

– Ketan Panchal
Aug 29 '18 at 9:01





@rakesh Did you find any solution for this?? have u place an order using API.

– Ketan Panchal
Aug 29 '18 at 9:01













@KetanPanchal Not yet.

– Rakesh Jesadiya
Aug 29 '18 at 16:40





@KetanPanchal Not yet.

– Rakesh Jesadiya
Aug 29 '18 at 16:40













you can not you have to process the payment through paypal, hold the txn and correlation id and then pass these through additional_information. this goes for any offsite payment method

– TTech IT Solutions
Aug 29 '18 at 19:14





you can not you have to process the payment through paypal, hold the txn and correlation id and then pass these through additional_information. this goes for any offsite payment method

– TTech IT Solutions
Aug 29 '18 at 19:14













@TTechITSolutions Did u know which parameter we can pass through Payflow pro using API?? I have sent below request parameter and getting an error magento.stackexchange.com/questions/239676/…

– Ketan Panchal
Aug 30 '18 at 4:07







@TTechITSolutions Did u know which parameter we can pass through Payflow pro using API?? I have sent below request parameter and getting an error magento.stackexchange.com/questions/239676/…

– Ketan Panchal
Aug 30 '18 at 4:07












2 Answers
2






active

oldest

votes


















1














Use below tutorial for place order:



https://devdocs.magento.com/guides/v2.3/rest/tutorials/orders/order-create-order.html



You can directly use below request




POST http:///rest/default/V1/carts/mine/payment-information




for place order.



If you looking for online payment method then check this request in your browser console at payment page and pass required parameters. Generally magento suggest do not pass card detail to server instead pass token so you have to generate card token from your end pass into above rest api and for save card you have to pass public hash .






share|improve this answer

































    0














    Unfortunately, the REST tutorial only addresses offline payment workflow:




    • Step 7: Create an order

    • unlisted step: accept payment offline

    • Step 8: Create an invoice

    • Step 9: Create a shipment


    The online payment work flow should run like this:




    • Step 7: Create an order

    • Step 8: Create an invoice = POST https://host/rest/default/V1/order/123/invoice

    • unlisted step: capture payment = POST https://host/rest/default/V1/invoices/123/capture

    • Step 9: Create a shipment






    share|improve this answer








    New contributor




    hanmari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.




















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "479"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f188939%2fhow-to-capture-creditcard-payment-using-sales-order-rest-api-magento-2%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      Use below tutorial for place order:



      https://devdocs.magento.com/guides/v2.3/rest/tutorials/orders/order-create-order.html



      You can directly use below request




      POST http:///rest/default/V1/carts/mine/payment-information




      for place order.



      If you looking for online payment method then check this request in your browser console at payment page and pass required parameters. Generally magento suggest do not pass card detail to server instead pass token so you have to generate card token from your end pass into above rest api and for save card you have to pass public hash .






      share|improve this answer






























        1














        Use below tutorial for place order:



        https://devdocs.magento.com/guides/v2.3/rest/tutorials/orders/order-create-order.html



        You can directly use below request




        POST http:///rest/default/V1/carts/mine/payment-information




        for place order.



        If you looking for online payment method then check this request in your browser console at payment page and pass required parameters. Generally magento suggest do not pass card detail to server instead pass token so you have to generate card token from your end pass into above rest api and for save card you have to pass public hash .






        share|improve this answer




























          1












          1








          1







          Use below tutorial for place order:



          https://devdocs.magento.com/guides/v2.3/rest/tutorials/orders/order-create-order.html



          You can directly use below request




          POST http:///rest/default/V1/carts/mine/payment-information




          for place order.



          If you looking for online payment method then check this request in your browser console at payment page and pass required parameters. Generally magento suggest do not pass card detail to server instead pass token so you have to generate card token from your end pass into above rest api and for save card you have to pass public hash .






          share|improve this answer















          Use below tutorial for place order:



          https://devdocs.magento.com/guides/v2.3/rest/tutorials/orders/order-create-order.html



          You can directly use below request




          POST http:///rest/default/V1/carts/mine/payment-information




          for place order.



          If you looking for online payment method then check this request in your browser console at payment page and pass required parameters. Generally magento suggest do not pass card detail to server instead pass token so you have to generate card token from your end pass into above rest api and for save card you have to pass public hash .







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Oct 12 '18 at 6:33









          Ansar Husain

          1,680217




          1,680217










          answered Oct 12 '18 at 6:06









          Yogesh KarodiyaYogesh Karodiya

          1,89321235




          1,89321235

























              0














              Unfortunately, the REST tutorial only addresses offline payment workflow:




              • Step 7: Create an order

              • unlisted step: accept payment offline

              • Step 8: Create an invoice

              • Step 9: Create a shipment


              The online payment work flow should run like this:




              • Step 7: Create an order

              • Step 8: Create an invoice = POST https://host/rest/default/V1/order/123/invoice

              • unlisted step: capture payment = POST https://host/rest/default/V1/invoices/123/capture

              • Step 9: Create a shipment






              share|improve this answer








              New contributor




              hanmari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.

























                0














                Unfortunately, the REST tutorial only addresses offline payment workflow:




                • Step 7: Create an order

                • unlisted step: accept payment offline

                • Step 8: Create an invoice

                • Step 9: Create a shipment


                The online payment work flow should run like this:




                • Step 7: Create an order

                • Step 8: Create an invoice = POST https://host/rest/default/V1/order/123/invoice

                • unlisted step: capture payment = POST https://host/rest/default/V1/invoices/123/capture

                • Step 9: Create a shipment






                share|improve this answer








                New contributor




                hanmari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.























                  0












                  0








                  0







                  Unfortunately, the REST tutorial only addresses offline payment workflow:




                  • Step 7: Create an order

                  • unlisted step: accept payment offline

                  • Step 8: Create an invoice

                  • Step 9: Create a shipment


                  The online payment work flow should run like this:




                  • Step 7: Create an order

                  • Step 8: Create an invoice = POST https://host/rest/default/V1/order/123/invoice

                  • unlisted step: capture payment = POST https://host/rest/default/V1/invoices/123/capture

                  • Step 9: Create a shipment






                  share|improve this answer








                  New contributor




                  hanmari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.










                  Unfortunately, the REST tutorial only addresses offline payment workflow:




                  • Step 7: Create an order

                  • unlisted step: accept payment offline

                  • Step 8: Create an invoice

                  • Step 9: Create a shipment


                  The online payment work flow should run like this:




                  • Step 7: Create an order

                  • Step 8: Create an invoice = POST https://host/rest/default/V1/order/123/invoice

                  • unlisted step: capture payment = POST https://host/rest/default/V1/invoices/123/capture

                  • Step 9: Create a shipment







                  share|improve this answer








                  New contributor




                  hanmari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  share|improve this answer



                  share|improve this answer






                  New contributor




                  hanmari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered 36 mins ago









                  hanmarihanmari

                  101




                  101




                  New contributor




                  hanmari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  hanmari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  hanmari is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Magento Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f188939%2fhow-to-capture-creditcard-payment-using-sales-order-rest-api-magento-2%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Polycentropodidae

                      Magento 2 Error message: Invalid state change requested

                      Paulmy