descubraomundo / omnipay-pagarme

Pagar.Me driver for the Omnipay PHP payment processing library
MIT License
23 stars 5 forks source link

Credit card purchase with Token ( card_hash ) ? #6

Closed gui-gui closed 7 years ago

gui-gui commented 7 years ago

Is it possible to create a credit card charge using a token (card_hash) instead of passing the credit card details through the server?

Thanks for your time 👍

gpassarelli commented 7 years ago

@gui-gui , @Leuloch is the right person to help you with this.

Leuloch commented 7 years ago

@gui-gui Yes!

You can pass an array like:

$transaction = $gateway->authorize(array(
  'amount'           => '10.00',
  'soft_descriptor'  => 'test', // 13 characters allowed
  'payment_method'   => 'credit_card',
  'installments'     => 5,
  'postback_url'     => 'http://application.com/api/',
  'card_hash'        => 'card_k5sT...',
  'metadata'         => array(
                            'product_id' => 'ID1111',
                            'invoice_id' => 'IV2222',
                        ),
));

So, you don't need to create an instance of Omnipay\Pagarme\CreditCard, just pass the card_hash!

gui-gui commented 7 years ago

Awesome! thanks a lot @Leuloch and @gpassarelli 👍