mirror of
https://github.com/plutov/paypal.git
synced 2025-02-09 02:14:55 +01:00
payment description
This commit is contained in:
parent
83bba562c8
commit
03bfbaface
|
@ -9,10 +9,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// CreateDirectPaypalPayment sends request with payment
|
// CreateDirectPaypalPayment sends request with payment
|
||||||
func (c *Client) CreateDirectPaypalPayment(amount Amount, redirectURI string, cancelURI string) (*PaymentResponse, error) {
|
func (c *Client) CreateDirectPaypalPayment(amount Amount, redirectURI string, cancelURI string, description string) (*PaymentResponse, error) {
|
||||||
buf := bytes.NewBuffer([]byte("{\"intent\":\"sale\",\"payer\":{\"payment_method\":\"paypal\"}," +
|
buf := bytes.NewBuffer([]byte("{\"intent\":\"sale\",\"payer\":{\"payment_method\":\"paypal\"}," +
|
||||||
"\"transactions\":[{\"amount\":{\"total\":\"" + strconv.FormatFloat(amount.Total, 'f', 2, 64) +
|
"\"transactions\":[{\"amount\":{\"total\":\"" + strconv.FormatFloat(amount.Total, 'f', 2, 64) +
|
||||||
"\",\"currency\":\"" + amount.Currency + "\"},\"description\":\"logpacker.com\"}],\"redirect_urls\":{\"return_url\":\"" +
|
"\",\"currency\":\"" + amount.Currency + "\"},\"description\":\"" + description + "\"}],\"redirect_urls\":{\"return_url\":\"" +
|
||||||
redirectURI + "\",\"cancel_url\":\"" + cancelURI + "\"}}"))
|
redirectURI + "\",\"cancel_url\":\"" + cancelURI + "\"}}"))
|
||||||
req, err := http.NewRequest("POST", fmt.Sprintf("%s%s", c.APIBase, "/v1/payments/payment"), buf)
|
req, err := http.NewRequest("POST", fmt.Sprintf("%s%s", c.APIBase, "/v1/payments/payment"), buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user