6

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?

  • 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
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 .

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/V1/order/123/invoice
  • unlisted step: capture payment = POST https://host/rest/V1/invoices/345/capture
  • Step 9: Create a shipment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.