Add additional information to a order after payment in Big Commerce - api

I would like to add additional information to a customers order after they have made the payment and landed on the confirmation page.
I sell products that have to be installed into the customers car. I would like to capture the customers car make model and year of registration (perferably after the order have been taken to not distract from the sale process).
I was hoping this could be done with the Bigcommerce API; where I could present the customer with a form they can fill in, after they have purchased, on the Order confirmation page and the data can get added to the customers order somehow.
Is this possible or would it be easier to caputre the car details in the cart or checkout?
BTW: not all products will come with vehicle installation.
Has anyone done anything similar using the Big Commerce API?

You can have the customer add it in as a note during check-out, this might be the most economical route.

Not as of today. The PUT request for orders does not allow the same fields as POST (order creation) - http://developer.bigcommerce.com/api/orders#put-ordersidjson
But, this is slated to be pushed in the coming weeks. Then you will be able to simply execute a PUT request on a captured order to update the "staff_notes" or "customer_message" field.
However, if you want to capture this during order creation via API, you can already do something like the following -
$createFields = array('customer_id'=>0, 'date_created' => 'Tue, 20 Nov 2012 00:00:00 +0000','status_id'=>1,'billing_address' => array( "first_name"=> "Trisha", "last_name"=> "McLaughlin", "company"=> "", "street_1"=> "12345 W Anderson Ln", "street_2"=> "", "city"=> "Austin", "state"=> "Texas", "zip"=> "78757", "country"=> "United States", "country_iso2"=> "US", "phone"=> "", "email"=> "elsie#example.com" ), "shipping_addresses" => array(), "external_source" => "POS", "products" => array(), "staff_notes" => "some notes here" );
print_r(Bigcommerce::createOrder($createFields));

Related

Shopify - Client side order Tagging

As per the requirements I got, In the Shopify shop, admin should be able to search for the orders from a customer chosen delivery date. The only feasible thing I could find was to tag the orders with their delivery and to filter the orders from the tag. My question is whether there a proper way to tag the orders with a customer given delivery date when a order is created? (I'm not allowed use any paid app/plug-in)
There are two approaches I could figure out with the admin orders API, but both has issues,
Write a webhook (for order confirmation event) to an external server that could get the user selected delivery date and call the admin order API from there to tag the order - The issues are it's an overhead to maintain a server only for tagging the order and even if I do since admin API doesn't allow CORS is this feasible? (and since the shop owner doesn't even want to pay for a paid plugin, maintaining server is also not practical)
Call the admin API from the client-side after the order is confirmed. I tried this and it works as it's expected but the issue is I have to keep the admin API credentials for orders and transactions stored in the client-side JavaScript which is not a good practice at all, as per my knowledge.
It's allowed to create additional details about the order at the client side using cart-attributes, and they are shown at the admin order's page as well, but Shoify doesn't allow to search orders using cart-attributes added to the order.
I would be grateful if someone can suggest a solution for this.
You can actually do this with a Chrome plugin (or really complex bookmarklet) with no server side requirements. see https://developer.chrome.com/extensions/overview
your api calls would look something like the following POC scripts. API calls won't search the order by tags so you could skip that and filter by a note_attribute set via your theme's .liquid code. Your chrome plugin would then list open orders and display them by requested delivery date.
get an existing order and update its note attribute:
jQuery.get('/admin/orders/5803440262.json').then(function(d) {
console.log(d.order);
var so = {
id: d.order.id,
note_attributes: [{
name: 'Test Value',
value: 'Test'
}]
};
jQuery.ajax({
url: '/admin/orders/' + so.id + '.json',
type: 'PUT',
data: JSON.stringify({
order: so
}),
contentType: 'application/json'
}).then(function(d) {
console.log(JSON.stringify(d, null, ' '));
});
});
and reading orders:
jQuery.get('/admin/orders.json?limit=250').then(function(d) {
var count = 0;
d.orders.forEach(function(so) {
if (so.tags.indexOf('__amazon_pending') != -1) count++;
});
console.log(count + ' matching orders');
});

Change status in Invoice using API - Quickbooks

I am working on Integrating Invoices to Quickbooks. I would like to change the Invoice status to Paid when creating/updating Invoice to Quickbook.
I don't find any way to update the Status of Invoice.
Any help would be really appreciated.
Invoices get marked paid in QuickBooks by applying a payment to the invoice.
Thus, you should review the documentation on creating PAYMENTS in QuickBooks:
https://developer.intuit.com/docs/api/accounting/payment
I noticed that when adding an invoice using the API its marked as paid / deposited even though i didn't add any payment.
To create an unpaid invoice I added: "LinkedTxn" => [],
so my request looks like this:
$theResourceObj = Invoice::create([
"Line" => $lineArray,
"DocNumber" => $invoiceid,
"GlobalTaxCalculation" => "TaxExcluded",
"ExchangeRate" => $exchangerate, #0.856164,
"LinkedTxn" => [],
"TxnDate" => $date, #2019-11-15
"DueDate" => $duedate,#2019-12-21
"InvoiceLink" => "https://my.webshop.com/?invoice=".$invoiceid,
"CustomerRef"=> [
"value"=> $quickbID
],
"CurrencyRef"=> [
"value"=> $currencycode #EUR
]
]);
Once invoice is added you should add the payment/s.
this will mark payment as paid.

Bigcommerce API - Create Shipment - Include all Items

according to the documentation, the Create Shipment method requires the property "items" - an array of the items being shipped, for example:
{
"tracking_number": "EJ958083578US",
"comments": "Ready to go...",
"order_address_id": 1,
"items": [
{
"order_product_id": 15,
"quantity": 2
}
]
}
In our business, a shipment almost invariably contains ALL items from the relevant order.
That being the case, is there a way to create a shipment without listing all items (which would require iterating over the product line-items)? Or, alternatively, a way to include all items by default (without iterating)?
We are simply wishing to automate the process of adding tracking numbers to orders - which (as a manual process) involves uploading a csv with [order_number: tracking_number] - i.e. it self-evidently assumes that all items are being shipped. The API seems not to include that (very sensible) option, but I may be wrong.
From Bigcommerce Support:
There is not a way to add a tracking number without adding a shipment nor a way to default the shipment to include all products. This is a helpful suggestion though that I will be passing on to our Product Team for possible implementation into future versions of the API.
Unfortunately for now it is necessary that you GET to the products subresource of an order and iterate over all of the products to pull their 'id' values and 'order_address_id' values so you can generate your POST request to the shipment subresource. It is not necessary to make a GET request to the shipping address subresource directly unless you want the details of that shipping address. It is also not necessary to make a GET request to the base order object unless you want details found there or you are looking to automate the process of checking for orders ready to ship.
So assuming you know an order ID that you want to ship it should only take 2 requests total to both GET the products subresource and then POST to the shipment resource.

How to change the next billing date with Braintree

I've looked over the docs (https://www.braintreepayments.com/docs/ruby/subscriptions/overview) and cannot see if it's possible to change the next billing date of an active subscription.
We want the ability to pause our user's subscriptions without cancelling their subscription. So I'm hoping we can update the user's next billing date by 1, 3, or 6 months at a time.
I work at Braintree. If you have trouble finding anything else in our docs, please feel free to reach out to our support team.
The list of updateable fields on subscriptions is:
subscription id
price
plan
payment method token
add-on and discount details
number of billing cycles
merchant account
The next billing date is calculated, and so can't be changed.
Instead, you can add a discount that will reduce the price to zero for a number of months:
result = Braintree::Subscription.update(
"the_subscription_id",
:discounts => {
:add => [
{
:inherited_from_id => "discount_id_1",
:amount => BigDecimal.new("7.00"),
:number_of_billing_cycles => 3
}
]
}
)

How can I use Stripe to delay charging a customer until a physical item is shipped?

I'm in the process of building an online marketplace which sells shippable goods. The site will be similar to Etsy, which will connect merchants with buyers.
I'd like to be able to charge a customer's card ONLY when an item is shipped by a merchant to avoid chargebacks and provide an Amazon-like payment experience. This will also help us avoid chargebacks and payment disputes in case a merchant is slow to ship or flakes out. In some cases, the goods will take more than 7 days to be custom manufactured and shipped out
Here's an example timeline:
1/1/2014 - Customer adds $75 worth of items to their cart and clicks "buy". Enters credit card info.
1/1/2014 - Customer's card is verified and a $75 temporary hold is placed on their card. Order is sent to merchant for fulfillment.
1/14/2014 - Merchant ships goods to customer and adds shipping tracking info
1/14/2014 - Customer's card is charged for the full amount and merchant receives $75 minus fees.
I plan to use Stripe Connect for payment processing, but am not sure how to delay capturing a payment for more than 7 days. Any thoughts? I don't want to aggregate the funds under my own account and use payouts since this will likely run afoul of money transmission laws. Any help would be appreciated!
EDIT: It looks like Quora has a similar question here , but the answers don't seem to deal with the case where a merchant ships out the item but the payment fails.
After further research, it seems there's no way to delay capturing a charge past the 7 day authorization window.
But here's one way to delay a charge:
Tokenize a credit card using the stripe.js library
Create a new stripe customer passing in the token as the "card" param
An example from the Stripe FAQ: https://support.stripe.com/questions/can-i-save-a-card-and-charge-it-later
Note that the longer you wait between tokenizing a card and actually charging it, the more likely your charge will be declined for various reasons (expired card, lack of funds, fraud, etc). This also adds a layer of complexity (and lost sales) since you'll need to ask a buyer to resubmit payment info.
I'd still like to confirm that a certain amount can be charged (like a "preauthorization"), but this lets me at least charge the card at a later date.
Celery has built a service to help you do this with Stripe. They are very easy to use, but note that they charge 2% per transaction.
actually you can save user token and pay later with tracking info
# get the credit card details submitted by the form or app
token = params[:stripeToken]
# create a Customer
customer = Stripe::Customer.create(
card: token,
description: 'description for payinguser#example.com',
email: 'payinguser#example.com'
)
# charge the Customer instead of the card
Stripe::Charge.create(
amount: 1000, # in cents
currency: 'usd',
customer: customer.id
)
# save the customer ID in your database so you can use it later
save_stripe_customer_id(user, customer.id)
# later
customer_id = get_stripe_customer_id(user)
Stripe::Charge.create(
amount: 1500, # $15.00 this time
currency: 'usd',
customer: customer_id
)
Stripe release a delay method to place a hold without charging. https://stripe.com/docs/payments/capture-later
<?php
require_once('stripe-php/init.php');
\Stripe\Stripe::setApiKey('your stripe key');
$token = $_POST['stripeToken'];
$stripeinfo = \Stripe\Token::retrieve($token);
$email = $stripeinfo->email;
$customer = \Stripe\Customer::create(array(
"source" => $token,
"email" => $email)
);
?>