mirror of
https://github.com/plutov/paypal.git
synced 2025-02-02 15:10:36 +01:00
README missing endpoints how-to
This commit is contained in:
parent
61cd126fbe
commit
0cc2e3fc52
32
README.md
32
README.md
|
@ -19,7 +19,10 @@
|
||||||
* POST /v1/payments/orders/**ID**/capture
|
* POST /v1/payments/orders/**ID**/capture
|
||||||
* POST /v1/payments/orders/**ID**/do-void
|
* POST /v1/payments/orders/**ID**/do-void
|
||||||
|
|
||||||
#### Create client
|
#### Missing endpoints
|
||||||
|
It is possible that some endpoints are missing in this SDK Client, but you can use built-in **paypalsdk** functions to perform a request: **NewClient -> NewRequest -> SendWithAuth**
|
||||||
|
|
||||||
|
#### Create Client
|
||||||
|
|
||||||
```go
|
```go
|
||||||
import "github.com/logpacker/paypalsdk"
|
import "github.com/logpacker/paypalsdk"
|
||||||
|
@ -116,68 +119,71 @@ payments, err := c.GetPayments()
|
||||||
#### Get authorization by ID
|
#### Get authorization by ID
|
||||||
|
|
||||||
```go
|
```go
|
||||||
auth, err := c.GetAuthorization("AUTH-1")
|
authID := "2DC87612EK520411B"
|
||||||
|
auth, err := c.GetAuthorization(authID)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Capture authorization
|
#### Capture authorization
|
||||||
|
|
||||||
```go
|
```go
|
||||||
capture, err := c.CaptureAuthorization("AUTH-1", &paypalsdk.Amount{Total: "200", Currency: "USD"}, true)
|
capture, err := c.CaptureAuthorization(authID, &paypalsdk.Amount{Total: "200", Currency: "USD"}, true)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Void authorization
|
#### Void authorization
|
||||||
|
|
||||||
```go
|
```go
|
||||||
auth, err := c.VoidAuthorization("AUTH-1")
|
auth, err := c.VoidAuthorization(authID)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Reauthorize authorization
|
#### Reauthorize authorization
|
||||||
|
|
||||||
```go
|
```go
|
||||||
auth, err := c.ReauthorizeAuthorization("AUTH-1", &paypalsdk.Amount{Total: "200", Currency: "USD"})
|
auth, err := c.ReauthorizeAuthorization(authID, &paypalsdk.Amount{Total: "200", Currency: "USD"})
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Get Sale by ID
|
#### Get Sale by ID
|
||||||
|
|
||||||
```go
|
```go
|
||||||
sale, err := c.GetSale("SALE-1")
|
saleID := "36C38912MN9658832"
|
||||||
|
sale, err := c.GetSale(saleID)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Refund Sale by ID
|
#### Refund Sale by ID
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// Full
|
// Full
|
||||||
refund, err := c.RefundSale("SALE-1", nil)
|
refund, err := c.RefundSale(saleID, nil)
|
||||||
// Partial
|
// Partial
|
||||||
refund, err := c.RefundSale("SALE-1", &paypalsdk.Amount{Total: "100", Currency: "USD"})
|
refund, err := c.RefundSale(saleID, &paypalsdk.Amount{Total: "100", Currency: "USD"})
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Get Refund by ID
|
#### Get Refund by ID
|
||||||
|
|
||||||
```go
|
```go
|
||||||
refund, err := c.GetRefund("ORDER-1")
|
orderID := "O-4J082351X3132253H"
|
||||||
|
refund, err := c.GetRefund(orderID)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Get Order by ID
|
#### Get Order by ID
|
||||||
|
|
||||||
```go
|
```go
|
||||||
order, err := c.GetOrder("ORDER-1")
|
order, err := c.GetOrder(orderID)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Authorize Order
|
#### Authorize Order
|
||||||
|
|
||||||
```go
|
```go
|
||||||
auth, err := c.AuthorizeOrder("ORDER-1", &paypalsdk.Amount{Total: "100", Currency: "USD"})
|
auth, err := c.AuthorizeOrder(orderID, &paypalsdk.Amount{Total: "100", Currency: "USD"})
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Capture Order
|
#### Capture Order
|
||||||
|
|
||||||
```go
|
```go
|
||||||
capture, err := c.CaptureOrder("ORDER-1", &paypalsdk.Amount{Total: "100", Currency: "USD"}, true, nil)
|
capture, err := c.CaptureOrder(orderID, &paypalsdk.Amount{Total: "100", Currency: "USD"}, true, nil)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Void Order
|
#### Void Order
|
||||||
|
|
||||||
```go
|
```go
|
||||||
order, err := c.VoidOrder("ORDER-1")
|
order, err := c.VoidOrder(orderID)
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue
Block a user