Save payment later with activist

The active merchant seems like a pleasant gem for payments. However, I need the ability to save the customer's billing information and then charge the card at a later time (i.e. at the time of delivery, not at the time of ordering).

Both Braintree and Stripe have a way of doing this by giving me the client ID to save it. Then I would use that ID to charge the client at some point.

I looked at the code of an active trading network , and it purchase()

has comments:

   # To create a charge on a customer, call
   #   purchase(money, nil, { :customer => id, ... })

      

There seems to be a way to get the client id.

How do I get the Active Merchant to create a customer object and return the customer ID for Stripe and Braintree? And is this feature supported in activemerchant for all gateways that support this payment method?

+3


source to share


1 answer


I work at Braintree. If you have more questions, you can always contact our support team .

Various methods that create or update a client / credit card in the Braintree store return :customer_vault_id

a response, for example :



Response.new(result.success?, message_from_result(result),
  {
    :braintree_customer => (
      customer_hash(result.customer, :include_credit_cards) if result.success?
    ),
    :customer_vault_id => (
      result.customer.id if result.success?
    ),
    :credit_card_token => (
      result.customer.credit_cards[0].token if result.success?
    )
  },
  :authorization => (result.customer.id if result.success?)
)

      

You can save this identifier and use it in subsequent calls purchase

.

+3


source







All Articles