Skip to content
nov matake edited this page May 23, 2011 · 7 revisions

Digital Goods

For Instant Payment

Setup transaction as described in Instant Payment with :category => :Digital and use popup_uri instead of redirect_uri.

request = Paypal::Express::Request.new(
  :username   => SET_YOUR_OWN,
  :password   => SET_YOUR_OWN,
  :signature  => SET_YOUR_OWN
)
payment_request = Paypal::Payment::Request.new(
  :currency_code => :JPY, # if nil, PayPal use USD as default
  :amount        => SET_YOUR_OWN,
  :items => [{
    :name => SET_YOUR_OWN,
    :description => SET_YOUR_OWN,
    :amount => SET_YOUR_OWN,
    :category => :Digital
  }]
)
response = request.setup(
  payment_request,
  YOUR_SUCCESS_CALBACK_URL,
  YOUR_CANCEL_CALBACK_URL,
  :no_shipping => true
)
response.popup_uri

After that, follow Instant Payment’s step.

For Recurring Payment

Setup transaction as described in Recurring Payment, and use popup_uri instead of redirect_uri.

request = Paypal::Express::Request.new(
  :username   => SET_YOUR_OWN,
  :password   => SET_YOUR_OWN,
  :signature  => SET_YOUR_OWN
)
payment_request = Paypal::Payment::Request.new(
  :currency_code => :JPY, # if nil, PayPal use USD as default
  :billing_type  => :RecurringPayments,
  :billing_agreement_description => SET_YOUR_OWN
)
response = request.setup(
  payment_request,
  YOUR_SUCCESS_CALBACK_URL,
  YOUR_CANCEL_CALBACK_URL,
  :no_shipping => true
)
response.popup_uri

After that, follow Recurring Payment’s step.

Clone this wiki locally