@@ -6,64 +6,78 @@ The PayPal REST SDK provides Ruby APIs to create, process and manage payment.
6
6
7
7
Add this line to your application's Gemfile:
8
8
9
- gem 'paypal-sdk-rest'
10
-
11
- # gem 'paypal-sdk-core', :git => "https://github.com/paypal/sdk-core-ruby.git"
12
- # gem 'paypal-sdk-rest', :git => "https://github.com/paypal/rest-api-sdk-ruby.git"
9
+ ``` ruby
10
+ gem ' paypal-sdk-rest'
11
+ ```
13
12
14
13
And then execute:
15
14
16
- $ bundle
15
+ ``` sh
16
+ $ bundle
17
+ ```
17
18
18
19
Or install it yourself as:
19
20
20
- $ gem install paypal-sdk-rest
21
+ ``` sh
22
+ $ gem install paypal-sdk-rest
23
+ ```
21
24
22
25
## Configuration
23
26
24
27
For Rails application:
25
28
26
- rails g paypal:sdk:install
29
+ ``` sh
30
+ rails g paypal:sdk:install
31
+ ```
27
32
28
33
For other ruby application, create a configuration file(` config/paypal.yml ` ):
29
34
30
- development: &default
31
- client_id: EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM
32
- client_secret: EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM
33
- mode: sandbox
34
- # # with Proxy
35
- # http_proxy: http://proxy-ipaddress:3129/
36
- # # with CA File
37
- # ssl_options:
38
- # ca_file: config/cacert.pem
39
- # # Override Endpoint
40
- # rest_endpoint: https://api.sandbox.paypal.com
41
- test:
42
- <<: *default
43
- production:
44
- <<: *default
45
- mode: live
35
+ ``` yaml
36
+ development : &default
37
+ mode : sandbox
38
+ client_id : EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM
39
+ client_secret : EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM
40
+ # # with Proxy
41
+ # http_proxy: http://proxy-ipaddress:3129/
42
+ # # with CA File
43
+ # ssl_options:
44
+ # ca_file: config/cacert.pem
45
+ # # Override Endpoint
46
+ # rest_endpoint: https://api.sandbox.paypal.com
47
+ test :
48
+ << : *default
49
+ production :
50
+ mode : live
51
+ client_id : CLIENT_ID
52
+ client_secret : CLIENT_SECRET
53
+ ` ` `
46
54
47
55
48
56
Load Configurations from specified file:
49
57
50
- PayPal::SDK::Core::Config.load('spec/config/paypal.yml', ENV['RACK_ENV'] || 'development')
58
+ ` ` ` ruby
59
+ PayPal::SDK::Core::Config.load('spec/config/paypal.yml', ENV['RACK_ENV'] || 'development')
60
+ ```
51
61
52
62
Without configuration file:
53
63
54
- PayPal::SDK::REST.set_config(
55
- :client_id => "EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM",
56
- :client_secret => "EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM",
57
- :mode => "sandbox", # "sandbox" or "live"
58
- :ssl_options => { } )
64
+ ``` ruby
65
+ PayPal ::SDK ::REST .set_config(
66
+ :client_id => " EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM" ,
67
+ :client_secret => " EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM" ,
68
+ :mode => " sandbox" , # "sandbox" or "live"
69
+ :ssl_options => { } )
70
+ ```
59
71
60
72
Override configuration:
61
73
62
- # Class level
63
- Payment.set_config( :client_id => "123" )
74
+ ``` ruby
75
+ # Class level
76
+ Payment .set_config( :client_id => " 123" )
64
77
65
- # Object level
66
- payment.set_config( :client_id => "123" )
78
+ # Object level
79
+ payment.set_config( :client_id => " 123" )
80
+ ```
67
81
68
82
69
83
## Create Payment
0 commit comments