Ruby-PayPalPayPal的Ruby API

联合创作 · 2023-10-01 03:48

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
浏览 19
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报