Once you have an
access_token, you are ready to perform actions on behalf of that merchant.
The only difference between the API to perform actions on behalf of a merchant and for a merchant performing their own actions is that the
gateway object used to make API calls must be instantiated with an access token instead of a client ID and secret.
This is how to create a transaction using an access token:
gateway = Braintree::Gateway.new( :access_token => use_access_token_for_merchant ) result = gateway.transaction.sale( :amount => "100.00", :payment_method_nonce => nonce_from_the_client ) transaction_id = result.transaction.id
Here's how you would create a customer for a merchant:
gateway = Braintree::Gateway.new( :access_token => use_access_token_for_merchant ) result = gateway.customer.create( :first_name => "Joe", :last_name => "Brown", :email => "firstname.lastname@example.org", :phone => "312.555.1234", ) customer_id = result.customer.id
The merchant has the right to revoke an authorization grant at any time. If this occurs, you will receive a
Braintree::AuthenticationError when attempting to take any action on the merchant’s behalf.
Still have questions?
If you can’t find an answer, contact our Support team.