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

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

Related

Adding a sales receipt to Quickbooks Online with .NET using the IPP SDK API

This probably has a really obvious answer, but I've been stuck searching for it for a few hours now.
I'm trying to figure out how to create the sales receipt using the sdk api, for linking a payment made by a customer to his invoice. As far as I can tell, if I don't do this, the payment will get deposited to the account but the invoice will never be updated.
I'm able to read invoices, make credit card or echeck payments, and read the customer record.
But I'm trying to create a sales receipt, and I'm not quite sure how to do it.
I can read the customer record but how do I add it to the sales receipt?
This just gives me a syntax error:
Customer customer = readCustomerUsingEmail(email);
SalesReceipt salesReceipt = new SalesReceipt();
salesReceipt.CustomerRef = Customer;
When I hover over customer, it states "Cannot implicitly convert type 'Intuit.Ipp.Data.Customer' to 'Intuit.Ipp.Data.ReferenceType'".
Edit: Ok. I'm now using the Payment object instead of the SalesReceipt object.
I think I've figured out the answer but I haven't run it yet. It just doesn't show a syntax error.
ReferenceType customerRef = new ReferenceType()
{
Value = customerData.Customer.Id,
name = customerData.Customer.DisplayName
};
payment.CustomerRef = customerRef;
You're attempting to do something very wrong here: create the sales receipt using the sdk api, for linking a payment made by a customer to his invoice
That is not what a sales receipt does.
Invoice - Indicates a customer owes you money.
Payment - Indicates a customer paid you money -- this is essentially the "other side" of an invoice. You create an invoice to indicate they owe money, and you create a payment to pay off the invoice.
Sales Receipt - Indicates a customer both owed you money and already paid. e.g. this is essentially an invoice and a payment combined into one object, for use when both the invoice and payment happened at the same time.
Soooo...
A sales receipt can not link to an invoice
A sales receipt is not used to link a payment to an invoice
What you should be doing is just creating a payment, and linking the payment directly to the invoice. To create a payment, you need to supply at minimum:
The customer (the CustomerRef field)
The total amount (the TotalAmt field)
A Line object (for use linking to an invoice)
The line Amount (if it's a payment for a single invoice this generally be equal to the TotalAmt field
A LinkedTxn node, which a link to the Invoice to pay (the TxnId field)
See the examples of creating a payment and additional docs here: https://developer.intuit.com/docs/api/accounting/payment
Example:
{
"CustomerRef":
{
"value": "20",
"name": "Red Rock Diner"
},
"TotalAmt": 55.00,
"Line": [
{
"Amount": 55.00,
"LinkedTxn": [
{
"TxnId": "69",
"TxnType": "Invoice"
}]
}]
}
There's tons of sample code here:
https://developer.intuit.com/docs/00_quickbooks_online/2_build/40_sdks/01_.net/0004_sample_code_and_sample_apps
And one specific to Payments here:
https://github.com/IntuitDeveloper/SampleApp-CRUD-.Net/blob/master/SampleApp_CRUD_.Net/SampleApp_CRUD_.Net/Entities/TransactionEntities/Payment.cs

how to get latest App version from itunes

i Want to forcefully update app to user for this i have used https://itunes.apple.com/lookup?id=1240084177 but i am getting no version if i use same url for paytm app with app id 473941634, then getting total response is
{
"resultCount": 1,
"results": [{
"artistViewUrl": "https://itunes.apple.com/us/developer/paytm-mobile-solutions/id473941637?uo=4",
"artworkUrl60": "http://is2.mzstatic.com/image/thumb/Purple118/v4/89/40/71/89407142-20e2-fb81-d9c8-1072ea8ee963/source/60x60bb.jpg",
"artworkUrl100": "http://is2.mzstatic.com/image/thumb/Purple118/v4/89/40/71/89407142-20e2-fb81-d9c8-1072ea8ee963/source/100x100bb.jpg",
"appletvScreenshotUrls": [],
"ipadScreenshotUrls": [],
"artworkUrl512": "http://is2.mzstatic.com/image/thumb/Purple118/v4/89/40/71/89407142-20e2-fb81-d9c8-1072ea8ee963/source/512x512bb.jpg",
"kind": "software",
"features": [],
"supportedDevices": ["iPad2Wifi-iPad2Wifi", "iPad23G-iPad23G", "iPhone4S-iPhone4S", "iPadThirdGen-iPadThirdGen", "iPadThirdGen4G-iPadThirdGen4G", "iPhone5-iPhone5", "iPodTouchFifthGen-iPodTouchFifthGen", "iPadFourthGen-iPadFourthGen", "iPadFourthGen4G-iPadFourthGen4G", "iPadMini-iPadMini", "iPadMini4G-iPadMini4G", "iPhone5c-iPhone5c", "iPhone5s-iPhone5s", "iPadAir-iPadAir", "iPadAirCellular-iPadAirCellular", "iPadMiniRetina-iPadMiniRetina", "iPadMiniRetinaCellular-iPadMiniRetinaCellular", "iPhone6-iPhone6", "iPhone6Plus-iPhone6Plus", "iPadAir2-iPadAir2", "iPadAir2Cellular-iPadAir2Cellular", "iPadMini3-iPadMini3", "iPadMini3Cellular-iPadMini3Cellular", "iPodTouchSixthGen-iPodTouchSixthGen", "iPhone6s-iPhone6s", "iPhone6sPlus-iPhone6sPlus", "iPadMini4-iPadMini4", "iPadMini4Cellular-iPadMini4Cellular", "iPadPro-iPadPro", "iPadProCellular-iPadProCellular", "iPadPro97-iPadPro97", "iPadPro97Cellular-iPadPro97Cellular", "iPhoneSE-iPhoneSE", "iPhone7-iPhone7", "iPhone7Plus-iPhone7Plus", "iPad611-iPad611", "iPad612-iPad612", "iPad71-iPad71", "iPad72-iPad72", "iPad73-iPad73", "iPad74-iPad74"],
"isGameCenterEnabled": false,
"screenshotUrls": ["http://a3.mzstatic.com/us/r30/Purple128/v4/3b/75/42/3b754226-d1a3-d76f-f949-61f572afad7e/screen696x696.jpeg", "http://a4.mzstatic.com/us/r30/Purple118/v4/f3/2e/7d/f32e7de7-3e75-b950-aa65-fde00c0b9bf3/screen696x696.jpeg", "http://a2.mzstatic.com/us/r30/Purple128/v4/66/9a/13/669a13f7-d551-3953-e7e8-61e15a06ec2b/screen696x696.jpeg", "http://a2.mzstatic.com/us/r30/Purple118/v4/2c/9b/f6/2c9bf618-d557-8b45-0f03-5d15aacf9284/screen696x696.jpeg", "http://a4.mzstatic.com/us/r30/Purple118/v4/07/3a/95/073a952a-6e98-eeef-f7e4-4965b31c2de0/screen696x696.jpeg"],
"advisories": [],
"trackViewUrl": "https://itunes.apple.com/us/app/paytm-payments-wallet-recharges/id473941634?mt=8&uo=4",
"trackCensoredName": "Paytm - Payments, Wallet & Recharges",
"contentAdvisoryRating": "4+",
"averageUserRatingForCurrentVersion": 4.5,
"languageCodesISO2A": ["EN", "HI"],
"fileSizeBytes": "131821568",
"sellerUrl": "http://www.paytm.com",
"userRatingCountForCurrentVersion": 16,
"trackContentRating": "4+",
"releaseNotes": "-You can now buy travel insurance along with your flight tickets!\n-Worry no more about your bill payments and recharges. Check out the order summary page when you recharge or pay bills next time to set automatic payments.\n-Get your Paytm KYC process fast forwarded by using your Aadhaar Card\n-Change in plans after booking tickets for a movie? No worries! You can cancel your tickets now with a full refund! \n-UX improvements and bug fixes.",
"wrapperType": "software",
"version": "5.12.0",
"currency": "USD",
"description": "#PaytmKaro for the fastest recharge, bill payment & shopping experience. Quick, easy and secure, Paytm is trusted by over 220 million customers. Recharge your mobile, DTH, data card or metro card & also pay postpaid mobile, landline, electricity, water or gas bills. For your travel needs, book hotels, flight and bus tickets. Also pay school or college fee along with insurance premium. Shop your favourite items at best price. Use any payment option or Paytm Wallet for maximum convenience. \n\nUse Paytm Wallet to send/ receive money, pay for services such as cab or autorickshaw fare, dine-in, petrol pumps & even at a local store near you.\n\nWhat We Offer:\nQuick mobile bill payments & prepaid mobile recharges for Airtel, Vodafone, Idea, Reliance, BSNL, Tata, Aircel, MTS, Uninor, MTNL & more at Paytm\nDTH Recharge for Airtel DTH, Videocon D2H, Dish TV, Tata Sky & Sun TV\nPay Electricity Bills (BSES, NDPL, MSEB, BESCOM etc.) and Water Bills (Delhi Jal Board) or Gas Bill (Adani, Mahanagar, Siti) for various boards \nLandline Bill Payments for Airtel, Reliance, MTS and more \nData Card Recharge for BSNL, Reliance Net Connect, Tata Photon Plus, MTS Data card to name a few\nInstant Educational Fee Payment – Pay admission fee or registration fee of various educational institutes and save time\nRecharge Metro Card Online – Say goodbye to queues, recharge your Delhi metro card or Mumbai metro card instantly \nAdd money to your wallet with debit cards, credit cards, net banking from all leading banks; transfer money to any Paytm Wallet\nPay with Paytm Wallet – Now pay using the Paytm Wallet on your favourite sites like IRCTC, Dominos, PVR and more. Also use the Paytm Wallet to pay for your cab rides at Uber, Meru, Taxiforsure or while booking an auto ride with Jugnoo\nMake instant payments at several local stores through the Paytm Wallet. Pay for Petrol at Indian Oil Petrol Pumps, your favourite food outlet like Vaango & many other local stores\nGold Loan & Insurance Premium Payment – Enjoy easy & seamless insurance premium payment and gold loan payment facility at Paytm \nMovie Ticket Booking – Book tickets for new releases every week\nBus Ticket Booking – Book bus tickets online in minutes at Paytm, pick your preferred seats and get set for the journey\nHotel Booking – Booking hotels has become a convenient task, plan your next trip with Paytm and book hotels online across India\nFlight Booking – Check fares across multiple travel agents and get best fares on domestic flight bookings\nShop On-The-Go – Buy your favourite gadget or discover latest trends in lifestyle, explore an amazing shopping experience for over 1,000+ categories\nHassle-free Returns on Shopping – Not happy with what you’ve got? No worries, we’ll pick it up from you, without you having to bat an eyelid\nGet Exciting Cashback on mobile recharges, bill payments, shopping & more\nOrder History – Now all your recharge, bill payments & orders will show up at one place, track or repeat them with ease in future\n24x7 Customer Care – 0120-38883888\n\nKey Features:\nBrowse Plans – View tariff plans on full talktime, top-up, 3G and 2G data recharge on all major prepaid mobile operators in India\nEasy & Instant Recharge – Use your phonebook easily to pick and recharge numbers, we remember all your recent mobile recharge, DTH recharge & bill payment for convenient one-click recharge experience\nScan & Pay – Scan & use the QR code to pay at your local stores or pay for fuel\nDownload this amazing app and recharge your prepaid mobile phones, pay bills of postpaid mobiles, electricity, landline, datacard & DTH for non-stop service and enjoy an awesome shopping experience with great value offers of your choice within one click, at great prices!",
"artistId": 473941637,
"artistName": "Paytm Mobile Solutions",
"genres": ["Shopping", "Lifestyle"],
"price": 0.00,
"trackId": 473941634,
"trackName": "Paytm - Payments, Wallet & Recharges",
"bundleId": "com.one97.paytm",
"currentVersionReleaseDate": "2017-08-15T03:10:10Z",
"formattedPrice": "Free",
"primaryGenreName": "Shopping",
"isVppDeviceBasedLicensingEnabled": true,
"releaseDate": "2011-10-24T23:18:48Z",
"minimumOsVersion": "8.0",
"primaryGenreId": 6024,
"sellerName": "PayTM Mobile Solutions Private Limited",
"genreIds": ["6024", "6012"],
"averageUserRating": 4.5,
"userRatingCount": 1688
}]
}
while both app is lived on appstore.
Problem in your URL. When you want your app version and other details. You need to set url like https://itunes.apple.com/us/lookup?id=1240084177 like this.
You have to specify country code you will get all details like you want.
E.g. https://itunes.apple.com/in/lookup?id=1240084177

AuthorizeNET CIM Payments

I have moved Authorize.NET AIM to CIM. I have two questions to solve:
In Authorize.NET live account I can see two transaction for one transaction one is 0$ voided transaction and other one is real transaction, can I avoid 0$ transaction or it is for what?
$email_address = 'user' . time() . '#domain.com';
$description = 'Monthly Membership No. ' . md5(uniqid(rand(), true));
$customer_id = substr(md5(uniqid(rand(), true)), 16, 16);
// Create the profile
$cim->setParameter('email', $email_address);
$cim->setParameter('description', $description);
$cim->setParameter('merchantCustomerId', $customer_id);
$cim->createCustomerProfile();
In the above code can we sent customer real email instead of generated email?
will it be a compliance issue?
The $0 transaction is to verify the credit card is valid before creating the customer payment profile. No, you cannot stop it from happening and you want this to occur as it allows you to get immediate feedback if a payment profile is invalid. That way you can react to it immediately rather then waiting for their first payment to fail.
Yes, you can, and should, send the correct customer email. That random email is just an example to show you how it works. The same goes for the $description and $customer_id fields as well.

Posting credit to a bank account uri

If I already have the bank account token (id returned by balanced.js), do I need to do a get to credit the account?
The documentation at:
https://docs.balancedpayments.com/current/api.html?language=php#credit-an-existing-bank-account
says: To credit an existing bank account, you simply pass the amount to the nested credit endpoint of a bank account. The credits_uri is a convenient uri provided so that you can simply issue a POST with the amount and a credit shall be created.
But the example given below it, does a get on bank account first and then a credit.
How do I post to the credits_uri with the amount and other parameters without first doing a get?
If you don't want to get a GET first, you would need to store the credits_uri of the bank account in question and then POST directly to that. e.g.
$credit = new \Balanced\Credit(array(
"uri" => "/v1/bank_accounts/BA123123/credits", // the credits_uri from the bank account
"amount" => 100
))->save();

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.