API Integration: Magento and StripeUpdated 2 years ago
Below are the steps required to be able to integrate with our API for Order Management. Note, you would need to integrate with both Magento and Stripe.
1*** [USERNAME/PASSWORD - MEMBERS' CREDENTIALS]23POST /V1/integration/customer/token4HOST: https://members.greendropship.com/rest/default56HEADERS:7Content-Type: application/json89PAYLOAD:10{11 "username": "USERNAME",12 "password": "PASSWORD"13}1415RESPONSE: "CUSTOMER_TOKEN"
1*** [CUSTOMER_TOKEN = RESPONSE POST /V1/integration/customer/token]23POST /V1/carts/mine4HOST: https://members.greendropship.com/rest/default56HEADERS:7Content-Type: application/json8Authorization: Bearer CUSTOMER_TOKEN910PAYLOAD: []1112RESPONSE: QUOTE_ID
1*** [CUSTOMER_TOKEN = RESPONSE POST /V1/integration/customer/token]2*** [QUOTE ID = RESPONSE POST /V1/carts/mine]3*** [SKU / QTY REQUIRED FOR CUSTOMER - SAMPLE KHFM00086520 x 1]45POST /V1/carts/mine/items6HOST: https://members.greendropship.com/rest/default78HEADERS:9Content-Type: application/json10Authorization: Bearer CUSTOMER_TOKEN1112PAYLOAD:13{14 "cartItem": {15 "sku": "SKU",16 "qty": QTY,17 "quote_id": "QUOTE_ID"18 }19}2021RESPONSE:22{23 "item_id": 355351,24 "sku": "KHFM00086520",25 "qty": 1,26 "name": "BOBS RED MILL: Old Country Style Muesli Whole Grain Cereal, 18 oz",27 "product_type": "simple",28 "quote_id": "QUOTE_ID"29}
1*** [CUSTOMER_TOKEN = RESPONSE POST /V1/integration/customer/token]23Was used a sample address, need be submitted the shipping address of4the customer of our member.56From the response, can be selected which method should be used to7ship this order.89POST /V1/carts/mine/estimate-shipping-methods10HOST: https://members.greendropship.com/rest/default1112HEADERS:13Content-Type: application/json14Authorization: Bearer CUSTOMER_TOKEN1516PAYLOAD:17{18 "address": {19 "region_code": "CA",20 "country_id": "US",21 "street": [22 "123 Oak Ave"23 ],24 "postcode": "10577",25 "city": "Los Angeles",26 "firstname": "Henry",27 "lastname": "Aguilar",28 "email": "[email protected]",29 "telephone": "(222) 222-2222"30 }31}3233RESPONSE:34[35 {36 "carrier_code": "mpmultishipping",37 "method_code": "mpmultishipping",38 "carrier_title": "Vendor",39 "method_title": "MultiShipping",40 "amount": 0,41 "base_amount": 0,42 "available": true,43 "error_message": "",44 "price_excl_tax": 0,45 "price_incl_tax": 046 },47 {48 "available": true,49 "amount": 0,50 "carrier_code": "mpmultishipping",51 "carrier_title": "Vendor",52 "method_code": "mpmultishipping",53 "method_title": "MultiShipping",54 "sellerShipping": [55 {56 "seller_id": 4177,57 "item_ids": "355351",58 "products": "BOBS RED MILL: Old Country Style Muesli Whole Grain Cereal, 18 oz x 1",59 "seller_name": "GreenDropShip",60 "message": "(Flat rate shipping is based on cubic volume and total weight.)",61 "methods": {62 "webkulshipping_9": {63 "method": "USPS/UPS - 3 days Transit Time (Shipping)",64 "cost": 9.99,65 "base_amount": 9.99,66 "error": 067 },68 "webkulshipping_73": {69 "method": "FBA - Select ONLY if ordering FBA or WFS prep services. (Shipping)",70 "cost": 0,71 "base_amount": 0,72 "error": 073 }74 }75 }76 ]77 }78]
1*** [CUSTOMER_TOKEN = RESPONSE POST /V1/integration/customer/token]2*** [ADDRESS INFORMATION > SHIPPING ADDRESS SAMPLE]3*** [ADDRESS INFORMATION > BILLING ADDRESS SAMPLE]4*** [SHIPPING_CARRIER_CODE = RESPONSE POST /V1/carts/mine/estimate-shipping-methods]5*** [SHIPPING_METHOD_CODE = RESPONSE POST /V1/carts/mine/estimate-shipping-methods]67Was used a sample address for shipping, need be submitted the shipping address8of the customer of our member.910Was used a sample address for billing, need be submitted the billing address11of our member.1213Only valid mpmultishipping for SHIPPING_CARRIER_CODE and14SHIPPING_METHOD_CODE.1516From the response, where exists the key sellerShipping some data needs to be17extracted from the previous API call If only are being placed orders for18items from vendor Green Drop Ship.1920MULTI_CUSTOMSHIP = If is not an FBA order use the field cost of the21method "USPS/UPS - 3 days Transit Time (Shipping)". In this case, based on22the sample is $9.992324SELECTED_SHIPPING = JSON string with the following fields:2526 idx_vendor = Index key of the vendor27 idx_method = Index key of the selected method2829 'sellerid' => ['sellerShipping'][idx_vendor]['seller_id'],30 'itemid' => ['sellerShipping'][idx_vendor]['item_ids'],31 'price' => ['sellerShipping'][idx_vendor]['methods'][idx_method ]['cost'],32 'baseamount' => ['sellerShipping'][idx_vendor]['methods'][idx_method ]['base_amount'],33 'code' => ['sellerShipping'][idx_vendor]['methods'][idx_method ],34 'method' => ['sellerShipping'][idx_vendor]['methods'][idx_method ]['method']3536sample for SELECTED_SHIPPING:3738 {\"sellerid\":\"4177\",\"itemid\":\"355351\",\"price\":\"9.99\",\"baseamount\":\"9.99\",\"code\":\"webkulshipping_9\",\"method\":\"USPS/UPS - 3 days Transit Time (Shipping)\"}"3940POST /V1/carts/mine/shipping-information41HOST: https://members.greendropship.com/rest/default4243HEADERS:44Content-Type: application/json45Authorization: Bearer CUSTOMER_TOKEN4647PAYLOAD:48{49 "addressInformation": {50 "shipping_address": {51 "region_code": "CA",52 "country_id": "US",53 "street": ["123 Oak Ave"],54 "postcode": "10577",55 "city": "Los Angeles",56 "firstname": "Henry",57 "lastname": "Aguilar",58 "email": "[email protected]",59 "telephone": "(222) 222-2222"60 },61 "billing_address": {62 "region_code": "FL",63 "country_id": "US",64 "street": ["7807 NW 37TH STREET"],65 "postcode": "33166",66 "city": "Doral",67 "firstname": "Allen",68 "lastname": "Infante",69 "email": "[email protected]",70 "telephone": "(111) 111-1111"71 },72 "extension_attributes": {73 "multi_customship": "MULTI_CUSTOMSHIP",74 "selected_shipping": "SELECTED_SHIPPING",75 },76 "shipping_carrier_code": "SHIPPING_CARRIER_CODE",77 "shipping_method_code": "SHIPPING_METHOD_CODE"78 }79}8081RESPONSE:82{83 "payment_methods": [84 {85 "code": "stripe_payments",86 "title": "Credit Card"87 }88 ],89 "totals": {}90}91
1*** [CUSTOMER_TOKEN = RESPONSE POST /V1/integration/customer/token]2*** [STRIPE_TOKEN - NEED BE SUBMITTED THIS INFO FROM OUR MEMBER]3*** [METHOD = RESPONSE POST /V1/carts/mine/shipping_information (payment_methods.code)]45STRIPE_TOKEN format is pm_1EkcHALcxRajh5XXXXXXXXXX, you can6get this from the last email received when placing orders.78POST /V1/carts/mine/payment-information9HOST: https://members.greendropship.com/rest/default1011HEADERS:12Content-Type: application/json13Authorization: Bearer CUSTOMER_TOKEN1415PAYLOAD:16{17 "paymentMethod": {18 "method": "METHOD",19 "additional_data": {20 "token": "STRIPE_TOKEN"21 }22 }23}2425RESPONSE: ENTITY_ID
If you want to use Store Credits:
GET /V1/carts/mine/aw-get-customer-store-credit
* (Retrieve customer Store Credit details)
GET /V1/carts/mine/aw-store-credit
* (Returns information for a Store Credit in a specified cart)
PUT /V1/carts/mine/apply-aw-store-credit
* (Add Store Credit to a specified cart)
DELETE /V1/carts/mine/remove-aw-store-credit
* (Remove Store Credit from a specified cart)
In the script before placing the order (POST /V1/carts/mine/payment-information), the store credit needs to be applied.
1*** [CUSTOMER_TOKEN = RESPONSE POST /V1/integration/customer/token]23PUT /V1/carts/mine/apply-aw-store-credit4HOST: https://members.greendropship.com/rest/default56HEADERS:7Content-Type: application/json8Authorization: Bearer CUSTOMER_TOKEN910RESPONSE: true
1*** [CUSTOMER_TOKEN = RESPONSE POST /V1/integration/customer/token]2*** [METHOD = RESPONSE POST /V1/carts/mine/shipping_information]34The only method valid is "free" if you are paying the 100% of the5total amount with store credits67POST /V1/carts/mine/payment-information8HOST: https://members.greendropship.com/rest/default910HEADERS:11Content-Type: application/json12Authorization: Bearer CUSTOMER_TOKEN1314PAYLOAD:15{16 "paymentMethod": {17 "method": "free",18 "additional_data": null19 }20}2122RESPONSE: ENTITY_ID