@@ -63,33 +63,22 @@ Without configuration file:
63
63
64
64
``` ruby
65
65
PayPal ::SDK ::REST .set_config(
66
+ :mode => " sandbox" , # "sandbox" or "live"
66
67
:client_id => " EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM" ,
67
68
:client_secret => " EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM" ,
68
- :mode => " sandbox" , # "sandbox" or "live"
69
69
:ssl_options => { } )
70
70
```
71
71
72
- Override configuration:
73
-
74
- ``` ruby
75
- # Class level
76
- Payment .set_config( :client_id => " 123" )
77
-
78
- # Object level
79
- payment.set_config( :client_id => " 123" )
80
- ```
81
-
82
-
83
72
## Create Payment
84
73
85
74
``` ruby
86
75
require ' paypal-sdk-rest'
87
76
include PayPal ::SDK ::REST
88
77
89
78
PayPal ::SDK ::REST .set_config(
79
+ :mode => " sandbox" , # "sandbox" or "live"
90
80
:client_id => " EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM" ,
91
- :client_secret => " EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM" ,
92
- :mode => " sandbox" )
81
+ :client_secret => " EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM" )
93
82
94
83
# Build Payment object
95
84
@payment = Payment .new ({
@@ -117,15 +106,15 @@ PayPal::SDK::REST.set_config(
117
106
:currency => " USD" },
118
107
:description => " This is the payment transaction description." }]})
119
108
120
- # Make API call & get response
109
+ # Create Payment and return the status(true or false)
121
110
if @payment .create
122
111
@payment .id # Payment Id
123
112
else
124
113
@payment .error # Error Hash
125
114
end
126
115
```
127
116
128
- ## Get Payment
117
+ ## Get Payment details
129
118
130
119
``` ruby
131
120
# Fetch Payment
@@ -138,6 +127,8 @@ payment_history.payments
138
127
139
128
## Execute Payment
140
129
130
+ Only for [ Payment] ( https://github.com/paypal/rest-api-sdk-ruby/blob/master/samples/payment/create_with_paypal.rb ) with ` payment_method ` as ` "paypal" `
131
+
141
132
``` ruby
142
133
payment = Payment .find(" PAY-57363176S1057143SKE2HO3A" )
143
134
@@ -146,4 +137,3 @@ if payment.execute( :payer_id => "DUFRQ8GWYMJXC" )
146
137
else
147
138
payment.error # Error Hash
148
139
end
149
- ```
0 commit comments