Skip to content

Commit ec24b5e

Browse files
committed
Update samples [ci skip]
1 parent 760e1ea commit ec24b5e

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

README.md

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,33 +63,22 @@ Without configuration file:
6363

6464
```ruby
6565
PayPal::SDK::REST.set_config(
66+
:mode => "sandbox", # "sandbox" or "live"
6667
:client_id => "EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM",
6768
:client_secret => "EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM",
68-
:mode => "sandbox", # "sandbox" or "live"
6969
:ssl_options => { } )
7070
```
7171

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-
8372
## Create Payment
8473

8574
```ruby
8675
require 'paypal-sdk-rest'
8776
include PayPal::SDK::REST
8877

8978
PayPal::SDK::REST.set_config(
79+
:mode => "sandbox", # "sandbox" or "live"
9080
:client_id => "EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM",
91-
:client_secret => "EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM",
92-
:mode => "sandbox" )
81+
:client_secret => "EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM")
9382

9483
# Build Payment object
9584
@payment = Payment.new({
@@ -117,15 +106,15 @@ PayPal::SDK::REST.set_config(
117106
:currency => "USD" },
118107
:description => "This is the payment transaction description." }]})
119108

120-
# Make API call & get response
109+
# Create Payment and return the status(true or false)
121110
if @payment.create
122111
@payment.id # Payment Id
123112
else
124113
@payment.error # Error Hash
125114
end
126115
```
127116

128-
## Get Payment
117+
## Get Payment details
129118

130119
```ruby
131120
# Fetch Payment
@@ -138,6 +127,8 @@ payment_history.payments
138127

139128
## Execute Payment
140129

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+
141132
```ruby
142133
payment = Payment.find("PAY-57363176S1057143SKE2HO3A")
143134

@@ -146,4 +137,3 @@ if payment.execute( :payer_id => "DUFRQ8GWYMJXC" )
146137
else
147138
payment.error # Error Hash
148139
end
149-
```

0 commit comments

Comments
 (0)