Métodos de pago para Chile y el mundo

Seba Gamboa

CTO en Welcu

  • github.com/sagmor
  • twitter.com/sagmor

Cobrar en latinoamerica es un parto

En serio si pueden evitarlo, haganlo!

Awww, Stripe...

Stripe.api_key = "sk_test_mkGsLqEW6SLnZa487HYfJVLf"

  amount: 400,
  currency: "usd",
  card: {
    name: "John Doe",
    number: 4111111111111111,
    exp_month: 1,
    exp_year: 2014,
    cvc: 123
  description: "Give me the money!"

Awww, Stripe...

$ curl https://api.stripe.com/v1/charges \
    -u "sk_test_mkGsLqEW6SLnZa487HYfJVLf:" \
    -d "amount=400" \
    -d "currency=usd" \
    -d "card[name]=John Doe" \
    -d "card[number]=4111111111111111" \
    -d "card[exp_month]=1" \
    -d "card[exp_year]=2014" \
    -d "card[cvc]=123" \
    -d "description=Mum me can charge from thy terminal!"

"US Only" :(

Pero he oido de excepciones ;)

Paypal to the rescue

All new API

curl -v https://api.sandbox.paypal.com/v1/payments/payment \
-H 'Content-Type:application/json' \
-H 'Authorization:Bearer EOjEJigcsRhdOgD7_76lPfrr45UfuI43zzNzTktUk1MK' \
-d '{
    "return_url":"http://return URL here",
    "cancel_url":"http://cancel URL here"
      "description":"This is the payment transaction description."


Show me the money!

Retira tu platita con Retiros Multicaja

A veces na' que hacerle

Aceptar débito, aceptar CLP

Chan, chan, chaaaaaaann!!!!!

What if!


include TBK

@payment = Webpay::Payment.new({
  amount: 10_000,
  order_id: 1234,
  success_url: webpay_success_url,
  confirmation_url: webpay_confirmation_url
  failure_url: webpay_failure_url

redirect_to @payment.redirect_url


Iniciar un Pago

class WebpayController < ApplicationController
  def pay
    @payment = TBK::Webpay::Payment.new({
      amount: ORDER_AMOUNT,
      order_id: ORDER_ID,
      success_url: webpay_success_url,
      # Webpay can only access the HTTP protocol to a direct IP address (keep that in mind)
      confirmation_url: webpay_confirmation_url(host: SERVER_IP_ADDRESS, protocol: 'http'),
      failure_url: webpay_failure_url # success_url is used by default

    # Redirect the user to Webpay
    redirect_to @payment.redirect_url

Confirmar el pago

class WebpayController < ApplicationController
  def confirmation
    @confirmation = TBK::Webpay::Confirmation.new(request.raw_post)

    if ... # confirmation is invalid for some reason (wrong order_id or amount, double payment, etc...)
      render text: @confirmation.reject
      return # reject and stop execution

    if @confirmation.success?
      # EXITO!
      # perform everything you have to do here.

    # Acknowledge payment
    render text: @confirmation.acknowledge



creo que $500.000.000+ procesados de esta forma lo demuestran


  • Logger compatible con CGIs
    (Pa' que transbank no webee)
  • github.com/sagmor/tbk/issues

'U no liking using Ruby?

meesa Sorry :(

  1. https://github.com/sagmor/tbk/tree/master/lib/tbk/webpay
  2. http://sagmor.com/rants/technical/webpay-communication-protocol/

¡Hack Transbank!

Tranquilos no ese tipo de hacking ;)

Alguien dijo "Transbank developer network"?

Alguien les tiene que hacer la pega parece

Issue #16


Y latinoamerica?

Bastante menos documentadas pero con interfaz similar

  • github.com/sagmor/pagosonline
  • github.com/sagmor/pag_seguro
  • github.com/sagmor/mercado_pago

Muchas gracias