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.
Related
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.
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)
);
?>
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();
I've create a new merchant account on Balanced via the API. I added a bank account to this account and then tokenized the exact same bank account and then added that again. I was expecting the second association to throw a 409 telling me that the account could not be added.
I have two questions:
Why does the API allow me to add the exact same bank account / card to an account twice?
How can I detect this and not add the bank account / card to the account?
Here is the example of two bank accounts I've created on an account via the Ruby gem:
irb(main):029:0> #bank_accounts.items.each { |a|
puts "#{a["bank_name"]} #{a["bank_code"]} created-#{a["created_at"]} #{a["last_four"]} uri=#{a["uri"]} id=#{a["id"]}"
}; nil
123456789 created-2012-07-11T23:36:57.290555Z 2333 uri=/v1/marketplaces/TEST-MP4Z4RaRDF6TWqeupiVUSu8m/accounts/AC2tip2eDhi92THXXEkIdys1/bank_accounts/BA2mP9GtEPVB3v9DzWJ7ZH8B id=BA2mP9GtEPVB3v9DzWJ7ZH8B
123456789 created-2012-07-11T23:37:22.655007Z 2333 uri=/v1/marketplaces/TEST-MP4Z4RaRDF6TWqeupiVUSu8m/accounts/AC2tip2eDhi92THXXEkIdys1/bank_accounts/BA2PlMIVFyMSSzo2zzUZb2XA id=BA2PlMIVFyMSSzo2zzUZb2XA
=> nil
There is no constraint on adding duplicate bank accounts and cards as you note. This was a decision made to allow the developer to lessen the burden of writing code for catching duplicate bank accounts. Your feedback is noted and appreciated.
You can index the cards or bank accounts associated with a user, Balanced does not return the full card number but by comparing the last_four, expiration, and name you can tell if a card is a match, similar fields are available for bank accounts but swap expiration with bank_code (routing number).
The code to do something like this in Ruby would be:
require 'balanced'
Balanced.configure 'e1c5ad38d1c711e1b36c026ba7e239a9'
# duplicate cards
card1 = Balanced::Card.new(:card_number=>"4111111111111111", :expiration_month=>"12", :expiration_year=>"2020").save() # original card
card2 = Balanced::Card.new(:card_number=>"4111111111111111", :expiration_month=>"12", :expiration_year=>"2020").save() # our duplicate card
card3 = Balanced::Card.new(:card_number=>"4111111111111111", :expiration_month=>"12", :expiration_year=>"2021").save() # a different card
# create a new account
buyer = Balanced::Account.new(:email_address => '%d#example.org' % Time.now).save()
buyer.add_card(card1.uri)
# helper function
def has_card(cards, card)
cards.map { |c| c.last_four == card.last_four && c.expiration_month == card.expiration_month && c.expiration_year == card.expiration_year }.include? true
end
puts 'buyer already has this card' if has_card(buyer.cards, card2)
puts 'buyer does not have this card' if not has_card(buyer.cards, card3)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
You know those websites that let you type in your checking account number and the routing number, and then they can transfer money to and from your account?
How does that work? Any good services or APIs for doing that? Any gotchas?
The banks do have APIs for doing this, but only approved people/companies are allowed to interface with these systems. Because it actually involves transferring money around, the security requirements are pretty high in terms of how you handle the account numbers on your system.
Many sites that offer this feature for buying goods actually use a third party system to handle the actual money transfer into their account. This lowers the amount of trouble to implement the API, as well as putting the burden of security on the third party handling the money transfers.
If you are serious about setting up a system where you can accept bank account numbers, and exchange funds, you should contact your bank, and see what the actual requirements for implementing such a system. Each bank has their own system, along with their own rate regarding the cost of these transactions.
Some third parties I'm aware of are
Moneris
Cactus
Beanstream
I'm in Canada, although I think Moneris and Cactus operate in the US. I think Beanstream doesn't. Again, you can talk to your bank, and they can probably get you in touch with a third party who will help you with the transactions.
If you want to be able to initiate transfer of funds between accounts in different financial institutions (using account and routing number), you need to find a payment processing company that offers ACH (http://en.wikipedia.org/wiki/Automated_Clearing_House) transfer services. Usually these companies are subsidiary of a financial institution that already has access to ACH. For example. one such company is ACH Direct (http://www.achdirect.com/). I can't vouch for its services or reliability though, I am just giving it here as an example of what type of companies you need to search.
Of course, technically, you could try to connect to ACH directly. However, to do this, you need to follow the rules and regulations of NACHA (http://en.wikipedia.org/wiki/NACHA-The_Electronic_Payments_Association) when writing your software and pass rigorous certification. It's quite a big investment, so unless you are backed by couple of bilions of dollars, I wouldn't advise attempting this.
You can do this with a Moneris US eSELECTplus merchant account - you just need to have Automated Clearing House (ACH) enabled on your merchant account (unfortunately there is no equivalent to ACH currently available in Canada).
Here's an example of what a debit transaction looks like in the Moneris US PHP API:
<?php
require "../mpgClasses.php";
/************************ Request Variables **********************************/
$store_id='monusqa002'; //account credentials
$api_token='qatoken';
/************************ Transaction Object******************************/
$txnArray=array(type=>'us_ach_debit',
order_id=>'ach-'.date("dmy-G:i:s"),
cust_id=> 'my cust id',
amount=>'1.00'
);
$achTemplate = array(
sec =>'ppd',
cust_first_name => 'Bob',
cust_last_name => 'Smith',
cust_address1 => '101 Main St',
cust_address2 => 'Apt 102,
cust_city => 'Chicago',
cust_state => 'IL',
cust_zip =>'123456',
routing_num => '490000018',
account_num => '23456',
check_num => '100',
account_type => 'savings'
);
$mpgAchInfo = new mpgAchInfo ($achTemplate);
$mpgTxn = new mpgTransaction($txnArray);
$mpgTxn->setAchInfo($mpgAchInfo);
$mpgRequest = new mpgRequest($mpgTxn);
$mpgHttpPost = new mpgHttpsPost($store_id,$api_token,$mpgRequest);
/************************ Response Object **********************************/
$mpgResponse=$mpgHttpPost->getMpgResponse();
print("\nCardType = " . $mpgResponse->getCardType());
print("\nTransAmount = " . $mpgResponse->getTransAmount());
print("\nTxnNumber = " . $mpgResponse->getTxnNumber());
print("\nReceiptId = " . $mpgResponse->getReceiptId());
print("\nTransType = " . $mpgResponse->getTransType());
print("\nReferenceNum = " . $mpgResponse->getReferenceNum());
print("\nResponseCode = " . $mpgResponse->getResponseCode());
print("\nMessage = " . $mpgResponse->getMessage());
print("\nAuthCode = " . $mpgResponse->getAuthCode());
print("\nComplete = " . $mpgResponse->getComplete());
print("\nTransDate = " . $mpgResponse->getTransDate());
print("\nTransTime = " . $mpgResponse->getTransTime());
print("\nTicket = " . $mpgResponse->getTicket());
print("\nTimedOut = " . $mpgResponse->getTimedOut());
?>
The API files and integration guides for Moneris USA are available at:
http://developer.moneris.com (free registration required)
Moneris USA - ACH:
http://www.monerisusa.com/payment-processing-services/ach-direct-debit.aspx
Stripe Connect allows you to transfer money to bank accounts and to accept payments through one unified API. As of December 2015 they provide more thorough documentation and in general seem to be a more popular option among developers than most of the companies mentioned in other answers.
See https://stripe.com/docs/connect for more info.
Paypal has a fairly accessible API you can use within your program to accomplish some of this.
Pretty straightforward way of doing ACH transfers - https://www.dwolla.com/white-label
Depending on what you want to your application to do you'll need different functionality.
If you want to pay (credit) bank accounts. It's pretty straight forward. Here are the steps:
1. Create a member
2. Create a funding source
3. Create a transfer
If you want to debit and credit bank accounts it gets a little more complex. Here are the steps:
1. Create a member
2. Get a funding source authorization
3. Create a transfer
The only reason the authorization is a little harder is because you have to go through a 2 deposit method or a verification flow of some type. This gets a lot easier with Dwolla.js - https://www.dwolla.com/dwollajs-bank-verification