How to change the next billing date with Braintree - billing

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
}
]
}
)

Related

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.

eBay API: retrieve full item listing by SiteID

Does anyone know how to retrieve a full listing of items by Site (ebay.us, ebay.fr ..) using ebay API?
I am using the Large Merchant Service because I manage thousands of items on each site (about 100k).
https://developer.ebay.com/devzone/large-merchant-services/concepts/lms_apiguide.html
1st solution i have tried (Active Inventory Report) According the doc :
Retrieving an Active Inventory Report
The ActiveInventoryReportRequest allows you to download a description
of all of your active listings by SKU. The SKU details include ItemID,
Price, Quantity, SKU, and SiteID.
I have checked with premium support and there is a mistake, SiteID is never included in response.
2nd solution (GetSellerList)
https://developer.ebay.com/devzone/xml/docs/reference/ebay/GetSellerList.html
According to the docs:
GetSellerList returns a maximum of 5,000 items per call (this is possible if you do not specify a Detail Level, and thus return the
smallest set of data for each item). However, if you specify any
DetailLevel value (and thus increase the fields returned for each
item), you might need to use Pagination values to obtain the complete
result set. If you use a DetailLevel, the response can contain no more
than 200 items per call.
So can not use this one because of limitation to 5000 items and I do not know when items have been added, a few years ago for a bunch of them.
Any ideas?
Regards
You can get lots more than 5,000 results with GetSellerList, but you are right you can only get 200 at a time. The code below is part of a loop iterating through until HasMoreItems is false. The code is written in Perl and uses Net::eBay to connect.
my $result = $eBay->submitRequest( "GetSellerList",
{
UserID => "$ebay_settings{'ebay_account'}",
GranularityLevel => 'Medium',
EndTimeFrom => "$start_time",
EndTimeTo => "$end_time",
Pagination => {
EntriesPerPage => 200,
PageNumber => $page_number
}
}
);
if( ref $result ) {
$result->{HasMoreItems} eq "false" and $done = "Y";
}

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)
);
?>

Payment using credit card through balanced payment in rails step by step

I am new to use balanced payments.
After get credit card info what is first, second... all steps..
can any one give me step by step so i can do on that way.
Thanks in advance
The steps would depend on what type of application you're trying to develop.
The basis of the system is that you create a Customer for each of your users. balanced.js removes the need for you to be PCI compliant because the sensitive data is submitted directly to Balanced and never goes through your servers. You use balanced.js to tokenize credit cards and bank accounts and add them to specific Customer instances. Once you've got the cards and bank accounts added you can do things like debit customerBuyerA and credit customerSellerB.
Next, I encourage you to read through some of the common fee scenarios to get an idea of what's going to work well for your business. https://docs.balancedpayments.com/current/#collecting-your-fees
Both https://docs.balancedpayments.com/current/overview.html and https://docs.balancedpayments.com/current/api.html have plenty of information to get you going from there.
I encourage you to stop by #balanced on IRC to get any other development questions answered.
I solved using below code in test mode (in RUBY):
Install gem "balanced"
Assign API key
Balanced.configure('API KEY')
Accept user card info
card = Balanced::Card.new( :card_number => "4111111111111111",
:expiration_month => "12",
:expiration_year => "2020"
).save
Create buyer to debit fee
buyer = Balanced::Marketplace.my_marketplace.create_buyer(:card_uri => card.uri)
5 Debit from buyer account
`another_debit = buyer.debit(
:amount => 1000,
:appears_on_statement_as => "MARKETPLACE.COM"
)`
7 Credit to Merchant account (You need to verify Bank account first from here)
merchant = Balanced::Account.find('/v1/marketplaces/TEST-MP6wn7oEW117Yn9gKXuQaTIO/bank_accounts/BANK ACC ID')
merchant.credit('1000')
Hope work for any one and suggestion welcome.

Add additional information to a order after payment in Big Commerce

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));