PayPal的Ruby API:Ruby-PayPal

fmms 13年前

Ruby-PayPal 是 PayPal API 的 Ruby 语言封装版本。

安装方法:gem install ruby-paypal

示例代码:

username = <PayPal API username>  password = <PayPal API password>  signature = <PayPal API signature>    ipaddress = '192.168.1.1' # can be any IP address  amount = '100.00' # amount paid  card_type = 'VISA' # can be Visa, Mastercard, Amex etc  card_no = '4512345678901234' # credit card number  exp_date = '022010' # expiry date of the credit card  first_name = 'Sau Sheong'  last_name = 'Chang'    paypal = Paypal.new(username, password, signature) # uses the PayPal sandbox  response = paypal.do_direct_payment_sale(ipaddress, amount, card_type,                             card_no, exp_date, first_name, last_name)  if response.ack == 'Success' then       # do your thing  end

项目主页:http://www.open-open.com/lib/view/home/1335065132593