PayPal的Ruby API:Ruby-PayPal
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
本文由用戶 fmms 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!