paypal

package module
v2.0.5+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2019 License: MIT Imports: 13 Imported by: 18

README

Go Report Card Build Status Godoc

Go client for PayPal REST API

Currently supports v2 only, if you want to use v1, use v1.1.4 git tag.

Coverage

  • POST /v1/oauth2/token
  • POST /v1/identity/openidconnect/tokenservice
  • GET /v1/identity/openidconnect/userinfo/?schema=SCHEMA
  • POST /v1/payments/payouts
  • GET /v1/payments/payouts/ID
  • GET /v1/payments/payouts-item/ID
  • POST /v1/payments/payouts-item/ID/cancel
  • GET /v1/payment-experience/web-profiles
  • POST /v1/payment-experience/web-profiles
  • GET /v1/payment-experience/web-profiles/ID
  • PUT /v1/payment-experience/web-profiles/ID
  • DELETE /v1/payment-experience/web-profiles/ID
  • POST /v1/vault/credit-cards
  • DELETE /v1/vault/credit-cards/ID
  • PATCH /v1/vault/credit-cards/ID
  • GET /v1/vault/credit-cards/ID
  • GET /v1/vault/credit-cards
  • GET /v2/payments/authorization/ID
  • POST /v2/payments/authorization/ID/capture
  • POST /v2/payments/authorization/ID/void
  • POST /v2/payments/authorization/ID/reauthorize
  • GET /v2/payments/sale/ID
  • POST /v2/payments/sale/ID/refund
  • GET /v2/payments/refund/ID
  • POST /v2/checkout/orders
  • GET /v2/checkout/orders/ID
  • PATCH /v2/checkout/orders/ID
  • POST /v2/checkout/orders/ID/authorize
  • POST /v2/checkout/orders/ID/capture
  • POST /v2/payments/billing-plans
  • PATCH /v2/payments/billing-plans/ID
  • POST /v2/payments/billing-agreements
  • POST /v2/payments/billing-agreements/TOKEN/agreement-execute

Missing endpoints

It is possible that some endpoints are missing in this SDK Client, but you can use built-in paypal functions to perform a request: NewClient -> NewRequest -> SendWithAuth

New Client

import "github.com/plutov/paypal"

// Create a client instance
c, err := paypal.NewClient("clientID", "secretID", paypal.APIBaseSandBox)
c.SetLog(os.Stdout) // Set log to terminal stdout

accessToken, err := c.GetAccessToken()

Get authorization by ID

auth, err := c.GetAuthorization("2DC87612EK520411B")

Capture authorization

capture, err := c.CaptureAuthorization(authID, &paypal.Amount{Total: "7.00", Currency: "USD"}, true)

Void authorization

auth, err := c.VoidAuthorization(authID)

Reauthorize authorization

auth, err := c.ReauthorizeAuthorization(authID, &paypal.Amount{Total: "7.00", Currency: "USD"})

Get Sale by ID

sale, err := c.GetSale("36C38912MN9658832")

Refund Sale by ID

// Full
refund, err := c.RefundSale(saleID, nil)
// Partial
refund, err := c.RefundSale(saleID, &paypal.Amount{Total: "7.00", Currency: "USD"})

Get Refund by ID

refund, err := c.GetRefund("O-4J082351X3132253H")

Get Order by ID

order, err := c.GetOrder("O-4J082351X3132253H")

Create an Order

order, err := c.CreateOrder(paypal.OrderIntentCapture, []paypal.PurchaseUnitRequest{paypal.PurchaseUnitRequest{ReferenceID: "ref-id", Amount: paypal.Amount{Total: "7.00", Currency: "USD"}}})

Update Order by ID

order, err := c.UpdateOrder("O-4J082351X3132253H", []paypal.PurchaseUnitRequest{})

Authorize Order

auth, err := c.AuthorizeOrder(orderID, paypal.AuthorizeOrderRequest{})

Capture Order

capture, err := c.CaptureOrder(orderID, paypal.CaptureOrderRequest{})

Identity

token, err := c.GrantNewAccessTokenFromAuthCode("<Authorization-Code>", "http://example.com/myapp/return.php")
// ... or by refresh token
token, err := c.GrantNewAccessTokenFromRefreshToken("<Refresh-Token>")

Retreive user information

userInfo, err := c.GetUserInfo("openid")

Create single payout to email

payout := paypal.Payout{
    SenderBatchHeader: &paypal.SenderBatchHeader{
        EmailSubject: "Subject will be displayed on PayPal",
    },
    Items: []paypal.PayoutItem{
        paypal.PayoutItem{
            RecipientType: "EMAIL",
            Receiver:      "single-email-payout@mail.com",
            Amount: &paypal.AmountPayout{
                Value:    "15.11",
                Currency: "USD",
            },
            Note:         "Optional note",
            SenderItemID: "Optional Item ID",
        },
    },
}

payoutResp, err := c.CreateSinglePayout(payout)

Get payout by ID

payout, err := c.GetPayout("PayoutBatchID")

Get payout item by ID

payoutItem, err := c.GetPayoutItem("PayoutItemID")

Cancel unclaimed payout item by ID

payoutItem, err := c.CancelPayoutItem("PayoutItemID")

Create web experience profile

webprofile := WebProfile{
    Name: "YeowZa! T-Shirt Shop",
    Presentation: Presentation{
        BrandName:  "YeowZa! Paypal",
        LogoImage:  "http://www.yeowza.com",
        LocaleCode: "US",
    },

    InputFields: InputFields{
        AllowNote:       true,
        NoShipping:      NoShippingDisplay,
        AddressOverride: AddrOverrideFromCall,
    },

    FlowConfig: FlowConfig{
        LandingPageType:   LandingPageTypeBilling,
        BankTXNPendingURL: "http://www.yeowza.com",
    },
}

result, err := c.CreateWebProfile(webprofile)

Get web experience profile

webprofile, err := c.GetWebProfile("XP-CP6S-W9DY-96H8-MVN2")

List web experience profile

webprofiles, err := c.GetWebProfiles()

Update web experience profile


webprofile := WebProfile{
    ID: "XP-CP6S-W9DY-96H8-MVN2",
    Name: "Shop YeowZa! YeowZa! ",
}
err := c.SetWebProfile(webprofile)

Delete web experience profile

err := c.DeleteWebProfile("XP-CP6S-W9DY-96H8-MVN2")

Vault

// Store CC
c.StoreCreditCard(paypal.CreditCard{
    Number:      "4417119669820331",
    Type:        "visa",
    ExpireMonth: "11",
    ExpireYear:  "2020",
    CVV2:        "874",
    FirstName:   "Foo",
    LastName:    "Bar",
})

// Delete it
c.DeleteCreditCard("CARD-ID-123")

// Edit it
c.PatchCreditCard("CARD-ID-123", []paypal.CreditCardField{
    paypal.CreditCardField{
        Operation: "replace",
        Path:      "/billing_address/line1",
        Value:     "New value",
    },
})

// Get it
c.GetCreditCard("CARD-ID-123")

// Get all stored credit cards
c.GetCreditCards(nil)

How to Contribute

  • Fork a repository
  • Add/Fix something
  • Check that tests are passing
  • Create PR

Current contributors:

Tests

  • Unit tests: go test -v ./...
  • Integration tests: go test -tags=integration

Documentation

Overview

Package paypal provides a wrapper to PayPal API (https://developer.paypal.com/webapps/developer/docs/api/). The first thing you do is to create a Client (you can select API base URL using paypal contants).

c, err := paypal.NewClient("clientID", "secretID", paypal.APIBaseSandBox)

Then you can get an access token from PayPal:

accessToken, err := c.GetAccessToken()

After you have an access token you can call built-in functions to get data from PayPal. paypal will assign all responses to go structures.

Example
package main

import (
	paypal "github.com/plutov/paypal"
)

func main() {
	// Initialize client
	c, err := paypal.NewClient("clientID", "secretID", paypal.APIBaseSandBox)
	if err != nil {
		panic(err)
	}

	// Retrieve access token
	_, err = c.GetAccessToken()
	if err != nil {
		panic(err)
	}
}
Output:

Index

Examples

Constants

View Source
const (
	// APIBaseSandBox points to the sandbox (for testing) version of the API
	APIBaseSandBox = "https://api.sandbox.paypal.com"

	// APIBaseLive points to the live version of the API
	APIBaseLive = "https://api.paypal.com"

	// RequestNewTokenBeforeExpiresIn is used by SendWithAuth and try to get new Token when it's about to expire
	RequestNewTokenBeforeExpiresIn = time.Duration(60) * time.Second
)
View Source
const (
	NoShippingDisplay      uint = 0
	NoShippingHide         uint = 1
	NoShippingBuyerAccount uint = 2
)

Possible values for `no_shipping` in InputFields

https://developer.paypal.com/docs/api/payment-experience/#definition-input_fields

View Source
const (
	AddrOverrideFromFile uint = 0
	AddrOverrideFromCall uint = 1
)

Possible values for `address_override` in InputFields

https://developer.paypal.com/docs/api/payment-experience/#definition-input_fields

View Source
const (
	LandingPageTypeBilling string = "Billing"
	LandingPageTypeLogin   string = "Login"
)

Possible values for `landing_page_type` in FlowConfig

https://developer.paypal.com/docs/api/payment-experience/#definition-flow_config

View Source
const (
	AllowedPaymentUnrestricted         string = "UNRESTRICTED"
	AllowedPaymentInstantFundingSource string = "INSTANT_FUNDING_SOURCE"
	AllowedPaymentImmediatePay         string = "IMMEDIATE_PAY"
)

Possible value for `allowed_payment_method` in PaymentOptions

https://developer.paypal.com/docs/api/payments/#definition-payment_options

View Source
const (
	OrderIntentCapture   string = "CAPTURE"
	OrderIntentAuthorize string = "AUTHORIZE"
)

Possible value for `intent` in CreateOrder

https://developer.paypal.com/docs/api/orders/v2/#orders_create

View Source
const (
	ItemCategoryDigitalGood  string = "DIGITAL_GOODS"
	ItemCategoryPhysicalGood string = "PHYSICAL_GOODS"
)

Possible values for `category` in Item

https://developer.paypal.com/docs/api/orders/v2/#definition-item

View Source
const (
	ShippingPreferenceGetFromFile        string = "GET_FROM_FILE"
	ShippingPreferenceNoShipping         string = "NO_SHIPPING"
	ShippingPreferenceSetProvidedAddress string = "SET_PROVIDED_ADDRESS"
)

Possible values for `shipping_preference` in ApplicationContext

https://developer.paypal.com/docs/api/orders/v2/#definition-application_context

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Line1       string `json:"line1"`
	Line2       string `json:"line2,omitempty"`
	City        string `json:"city"`
	CountryCode string `json:"country_code"`
	PostalCode  string `json:"postal_code,omitempty"`
	State       string `json:"state,omitempty"`
	Phone       string `json:"phone,omitempty"`
}

Address struct

type AgreementDetails

type AgreementDetails struct {
	OutstandingBalance AmountPayout `json:"outstanding_balance"`
	CyclesRemaining    int          `json:"cycles_remaining,string"`
	CyclesCompleted    int          `json:"cycles_completed,string"`
	NextBillingDate    time.Time    `json:"next_billing_date"`
	LastPaymentDate    time.Time    `json:"last_payment_date"`
	LastPaymentAmount  AmountPayout `json:"last_payment_amount"`
	FinalPaymentDate   time.Time    `json:"final_payment_date"`
	FailedPaymentCount int          `json:"failed_payment_count,string"`
}

AgreementDetails struct

type Amount

type Amount struct {
	Currency string  `json:"currency"`
	Total    string  `json:"total"`
	Details  Details `json:"details,omitempty"`
}

Amount struct

type AmountPayout

type AmountPayout struct {
	Currency string `json:"currency"`
	Value    string `json:"value"`
}

AmountPayout struct

type ApplicationContext added in v1.1.1

type ApplicationContext struct {
	BrandName          string `json:"brand_name,omitempty"`
	Locale             string `json:"locale,omitempty"`
	LandingPage        string `json:"landing_page,omitempty"`
	ShippingPreference string `json:"shipping_preference,omitempty"`
	UserAction         string `json:"user_action,omitempty"`
	ReturnURL          string `json:"return_url,omitempty"`
	CancelURL          string `json:"cancel_url,omitempty"`
}

ApplicationContext struct

type Authorization

type Authorization struct {
	Amount                    *Amount    `json:"amount,omitempty"`
	CreateTime                *time.Time `json:"create_time,omitempty"`
	UpdateTime                *time.Time `json:"update_time,omitempty"`
	State                     string     `json:"state,omitempty"`
	ParentPayment             string     `json:"parent_payment,omitempty"`
	ID                        string     `json:"id,omitempty"`
	ValidUntil                *time.Time `json:"valid_until,omitempty"`
	Links                     []Link     `json:"links,omitempty"`
	ClearingTime              string     `json:"clearing_time,omitempty"`
	ProtectionEligibility     string     `json:"protection_eligibility,omitempty"`
	ProtectionEligibilityType string     `json:"protection_eligibility_type,omitempty"`
}

Authorization struct

type AuthorizeOrderRequest

type AuthorizeOrderRequest struct {
	PaymentSource      *PaymentSource     `json:"payment_source,omitempty"`
	ApplicationContext ApplicationContext `json:"application_context,omitempty"`
}

AuthorizeOrderRequest - https://developer.paypal.com/docs/api/orders/v2/#orders_authorize

type AuthorizeOrderResponse

type AuthorizeOrderResponse struct {
	CreateTime    *time.Time             `json:"create_time,omitempty"`
	UpdateTime    *time.Time             `json:"update_time,omitempty"`
	ID            string                 `json:"id,omitempty"`
	Status        string                 `json:"status,omitempty"`
	Intent        string                 `json:"intent,omitempty"`
	PurchaseUnits []PurchaseUnitRequest  `json:"purchase_units,omitempty"`
	Payer         *PayerWithNameAndPhone `json:"payer,omitempty"`
}

AuthorizeOrderResponse .

type BatchHeader

type BatchHeader struct {
	Amount            *AmountPayout      `json:"amount,omitempty"`
	Fees              *AmountPayout      `json:"fees,omitempty"`
	PayoutBatchID     string             `json:"payout_batch_id,omitempty"`
	BatchStatus       string             `json:"batch_status,omitempty"`
	TimeCreated       *time.Time         `json:"time_created,omitempty"`
	TimeCompleted     *time.Time         `json:"time_completed,omitempty"`
	SenderBatchHeader *SenderBatchHeader `json:"sender_batch_header,omitempty"`
}

BatchHeader struct

type BillingAgreement

type BillingAgreement struct {
	Name                        string               `json:"name,omitempty"`
	Description                 string               `json:"description,omitempty"`
	StartDate                   JSONTime             `json:"start_date,omitempty"`
	Plan                        BillingPlan          `json:"plan,omitempty"`
	Payer                       Payer                `json:"payer,omitempty"`
	ShippingAddress             *ShippingAddress     `json:"shipping_address,omitempty"`
	OverrideMerchantPreferences *MerchantPreferences `json:"override_merchant_preferences,omitempty"`
}

BillingAgreement struct

type BillingPlan

type BillingPlan struct {
	ID                  string               `json:"id,omitempty"`
	Name                string               `json:"name,omitempty"`
	Description         string               `json:"description,omitempty"`
	Type                string               `json:"type,omitempty"`
	PaymentDefinitions  []PaymentDefinition  `json:"payment_definitions,omitempty"`
	MerchantPreferences *MerchantPreferences `json:"merchant_preferences,omitempty"`
}

BillingPlan struct

type BillingPlanListParams

type BillingPlanListParams struct {
	Page          string `json:"page,omitempty"`           //Default: 0.
	Status        string `json:"status,omitempty"`         //Allowed values: CREATED, ACTIVE, INACTIVE, ALL.
	PageSize      string `json:"page_size,omitempty"`      //Default: 10.
	TotalRequired string `json:"total_required,omitempty"` //Default: no.

}

BillingPlanListParams struct

type BillingPlanListResp

type BillingPlanListResp struct {
	Plans      []BillingPlan `json:"plans,omitempty"`
	TotalItems string        `json:"total_items,omitempty"`
	TotalPages string        `json:"total_pages,omitempty"`
	Links      []Link        `json:"links,omitempty"`
}

BillingPlanListResp struct

type Capture

type Capture struct {
	Amount         *Amount    `json:"amount,omitempty"`
	IsFinalCapture bool       `json:"is_final_capture"`
	CreateTime     *time.Time `json:"create_time,omitempty"`
	UpdateTime     *time.Time `json:"update_time,omitempty"`
	State          string     `json:"state,omitempty"`
	ParentPayment  string     `json:"parent_payment,omitempty"`
	ID             string     `json:"id,omitempty"`
	Links          []Link     `json:"links,omitempty"`
}

Capture struct

type CaptureAmount

type CaptureAmount struct {
	ID     string              `json:"id,omitempty"`
	Amount *PurchaseUnitAmount `json:"amount,omitempty"`
}

CaptureAmount struct

type CaptureOrderRequest

type CaptureOrderRequest struct {
	PaymentSource *PaymentSource `json:"payment_source"`
}

CaptureOrderRequest - https://developer.paypal.com/docs/api/orders/v2/#orders_capture

type CaptureOrderResponse

type CaptureOrderResponse struct {
	ID            string                 `json:"id,omitempty"`
	Status        string                 `json:"status,omitempty"`
	Payer         *PayerWithNameAndPhone `json:"payer,omitempty"`
	PurchaseUnits []CapturedPurchaseUnit `json:"purchase_units,omitempty"`
}

CaptureOrderResponse is the response for capture order

type CapturedPayments

type CapturedPayments struct {
	Captures []CaptureAmount `json:"captures,omitempty"`
}

CapturedPayments has the amounts for a captured order

type CapturedPurchaseUnit

type CapturedPurchaseUnit struct {
	Payments *CapturedPayments `json:"payments,omitempty"`
}

CapturedPurchaseUnit are purchase units for a captured order

type CardBillingAddress

type CardBillingAddress struct {
	AddressLine1 string `json:"address_line_1"`
	AddressLine2 string `json:"address_line_2"`
	AdminArea2   string `json:"admin_area_2"`
	AdminArea1   string `json:"admin_area_1"`
	PostalCode   string `json:"postal_code"`
	CountryCode  string `json:"country_code"`
}

CardBillingAddress structure

type ChargeModel

type ChargeModel struct {
	Type   string       `json:"type,omitempty"`
	Amount AmountPayout `json:"amount,omitempty"`
}

ChargeModel struct

type Client

type Client struct {
	sync.Mutex
	Client   *http.Client
	ClientID string
	Secret   string
	APIBase  string
	Log      io.Writer // If user set log file name all requests will be logged there
	Token    *TokenResponse
	// contains filtered or unexported fields
}

Client represents a Paypal REST API Client

func NewClient

func NewClient(clientID string, secret string, APIBase string) (*Client, error)

NewClient returns new Client struct APIBase is a base API URL, for testing you can use paypal.APIBaseSandBox

func (*Client) ActivatePlan

func (c *Client) ActivatePlan(planID string) error

ActivatePlan activates a billing plan By default, a new plan is not activated Endpoint: PATCH /v2/payments/billing-plans/

func (*Client) AuthorizeOrder

func (c *Client) AuthorizeOrder(orderID string, authorizeOrderRequest AuthorizeOrderRequest) (*Authorization, error)

AuthorizeOrder - https://developer.paypal.com/docs/api/orders/v2/#orders_authorize Endpoint: POST /v2/checkout/orders/ID/authorize

func (*Client) CancelPayoutItem

func (c *Client) CancelPayoutItem(payoutItemID string) (*PayoutItemResponse, error)

CancelPayoutItem cancels an unclaimed Payout Item. If no one claims the unclaimed item within 30 days, the funds are automatically returned to the sender. Use this call to cancel the unclaimed item before the automatic 30-day refund. Endpoint: POST /v1/payments/payouts-item/ID/cancel

func (*Client) CaptureAuthorization

func (c *Client) CaptureAuthorization(authID string, a *Amount, isFinalCapture bool) (*Capture, error)

CaptureAuthorization captures and process an existing authorization. To use this method, the original payment must have Intent set to "authorize" Endpoint: POST /v2/payments/authorization/ID/capture

func (*Client) CaptureOrder

func (c *Client) CaptureOrder(orderID string, captureOrderRequest CaptureOrderRequest) (*CaptureOrderResponse, error)

CaptureOrder - https://developer.paypal.com/docs/api/orders/v2/#orders_capture Endpoint: POST /v2/checkout/orders/ID/capture

func (*Client) CreateBillingAgreement

func (c *Client) CreateBillingAgreement(a BillingAgreement) (*CreateAgreementResp, error)

CreateBillingAgreement creates an agreement for specified plan Endpoint: POST /v2/payments/billing-agreements

func (*Client) CreateBillingPlan

func (c *Client) CreateBillingPlan(plan BillingPlan) (*CreateBillingResp, error)

CreateBillingPlan creates a billing plan in Paypal Endpoint: POST /v2/payments/billing-plans

func (*Client) CreateOrder

func (c *Client) CreateOrder(intent string, purchaseUnits []PurchaseUnitRequest, payer *CreateOrderPayer, appContext *ApplicationContext) (*Order, error)

CreateOrder - Use this call to create an order Endpoint: POST /v2/checkout/orders

func (*Client) CreateSinglePayout

func (c *Client) CreateSinglePayout(p Payout) (*PayoutResponse, error)

CreateSinglePayout submits a payout with an asynchronous API call, which immediately returns the results of a PayPal payment. For email payout set RecipientType: "EMAIL" and receiver email into Receiver Endpoint: POST /v1/payments/payouts

func (*Client) CreateWebProfile

func (c *Client) CreateWebProfile(wp WebProfile) (*WebProfile, error)

CreateWebProfile creates a new web experience profile in Paypal

Allows for the customisation of the payment experience

Endpoint: POST /v1/payment-experience/web-profiles

func (*Client) DeleteCreditCard

func (c *Client) DeleteCreditCard(id string) error

DeleteCreditCard func Endpoint: DELETE /v1/vault/credit-cards/credit_card_id

func (*Client) DeleteWebProfile

func (c *Client) DeleteWebProfile(profileID string) error

DeleteWebProfile deletes a web experience profile from Paypal with given id

Endpoint: DELETE /v1/payment-experience/web-profiles

func (*Client) ExecuteApprovedAgreement

func (c *Client) ExecuteApprovedAgreement(token string) (*ExecuteAgreementResponse, error)

ExecuteApprovedAgreement - Use this call to execute (complete) a PayPal agreement that has been approved by the payer. Endpoint: POST /v2/payments/billing-agreements/token/agreement-execute

func (*Client) GetAccessToken

func (c *Client) GetAccessToken() (*TokenResponse, error)

GetAccessToken returns struct of TokenResponse No need to call SetAccessToken to apply new access token for current Client Endpoint: POST /v1/oauth2/token

func (*Client) GetAuthorization

func (c *Client) GetAuthorization(authID string) (*Authorization, error)

GetAuthorization returns an authorization by ID Endpoint: GET /v2/payments/authorization/ID

func (*Client) GetCreditCard

func (c *Client) GetCreditCard(id string) (*CreditCard, error)

GetCreditCard func Endpoint: GET /v1/vault/credit-cards/credit_card_id

func (*Client) GetCreditCards

func (c *Client) GetCreditCards(ccf *CreditCardsFilter) (*CreditCards, error)

GetCreditCards func Endpoint: GET /v1/vault/credit-cards

func (*Client) GetOrder

func (c *Client) GetOrder(orderID string) (*Order, error)

GetOrder retrieves order by ID Endpoint: GET /v2/checkout/orders/ID

func (*Client) GetPayout

func (c *Client) GetPayout(payoutBatchID string) (*PayoutResponse, error)

GetPayout shows the latest status of a batch payout along with the transaction status and other data for individual items. Also, returns IDs for the individual payout items. You can use these item IDs in other calls. Endpoint: GET /v1/payments/payouts/ID

func (*Client) GetPayoutItem

func (c *Client) GetPayoutItem(payoutItemID string) (*PayoutItemResponse, error)

GetPayoutItem shows the details for a payout item. Use this call to review the current status of a previously unclaimed, or pending, payout item. Endpoint: GET /v1/payments/payouts-item/ID

func (*Client) GetRefund

func (c *Client) GetRefund(refundID string) (*Refund, error)

GetRefund by ID Use it to look up details of a specific refund on direct and captured payments. Endpoint: GET /v2/payments/refund/ID

func (*Client) GetSale

func (c *Client) GetSale(saleID string) (*Sale, error)

GetSale returns a sale by ID Use this call to get details about a sale transaction. Note: This call returns only the sales that were created via the REST API. Endpoint: GET /v2/payments/sale/ID

func (*Client) GetUserInfo

func (c *Client) GetUserInfo(schema string) (*UserInfo, error)

GetUserInfo - Use this call to retrieve user profile attributes. Endpoint: GET /v1/identity/openidconnect/userinfo/?schema=<Schema> Pass the schema that is used to return as per openidconnect protocol. The only supported schema value is openid.

func (*Client) GetWebProfile

func (c *Client) GetWebProfile(profileID string) (*WebProfile, error)

GetWebProfile gets an exists payment experience from Paypal

Endpoint: GET /v1/payment-experience/web-profiles/<profile-id>

func (*Client) GetWebProfiles

func (c *Client) GetWebProfiles() ([]WebProfile, error)

GetWebProfiles retreieves web experience profiles from Paypal

Endpoint: GET /v1/payment-experience/web-profiles

func (*Client) GrantNewAccessTokenFromAuthCode

func (c *Client) GrantNewAccessTokenFromAuthCode(code, redirectURI string) (*TokenResponse, error)

GrantNewAccessTokenFromAuthCode - Use this call to grant a new access token, using the previously obtained authorization code. Endpoint: POST /v1/identity/openidconnect/tokenservice

func (*Client) GrantNewAccessTokenFromRefreshToken

func (c *Client) GrantNewAccessTokenFromRefreshToken(refreshToken string) (*TokenResponse, error)

GrantNewAccessTokenFromRefreshToken - Use this call to grant a new access token, using a refresh token. Endpoint: POST /v1/identity/openidconnect/tokenservice

func (*Client) ListBillingPlans

func (c *Client) ListBillingPlans(bplp BillingPlanListParams) (*BillingPlanListResp, error)

ListBillingPlans lists billing-plans Endpoint: GET /v2/payments/billing-plans

func (*Client) NewRequest

func (c *Client) NewRequest(method, url string, payload interface{}) (*http.Request, error)

NewRequest constructs a request Convert payload to a JSON

func (*Client) PatchCreditCard

func (c *Client) PatchCreditCard(id string, ccf []CreditCardField) (*CreditCard, error)

PatchCreditCard func Endpoint: PATCH /v1/vault/credit-cards/credit_card_id

func (*Client) ReauthorizeAuthorization

func (c *Client) ReauthorizeAuthorization(authID string, a *Amount) (*Authorization, error)

ReauthorizeAuthorization reauthorize a Paypal account payment. PayPal recommends to reauthorize payment after ~3 days Endpoint: POST /v2/payments/authorization/ID/reauthorize

func (*Client) RefundSale

func (c *Client) RefundSale(saleID string, a *Amount) (*Refund, error)

RefundSale refunds a completed payment. Use this call to refund a completed payment. Provide the sale_id in the URI and an empty JSON payload for a full refund. For partial refunds, you can include an amount. Endpoint: POST /v2/payments/sale/ID/refund

func (*Client) Send

func (c *Client) Send(req *http.Request, v interface{}) error

Send makes a request to the API, the response body will be unmarshaled into v, or if v is an io.Writer, the response will be written to it without decoding

func (*Client) SendWithAuth

func (c *Client) SendWithAuth(req *http.Request, v interface{}) error

SendWithAuth makes a request to the API and apply OAuth2 header automatically. If the access token soon to be expired or already expired, it will try to get a new one before making the main request client.Token will be updated when changed

func (*Client) SendWithBasicAuth

func (c *Client) SendWithBasicAuth(req *http.Request, v interface{}) error

SendWithBasicAuth makes a request to the API using clientID:secret basic auth

func (*Client) SetAccessToken

func (c *Client) SetAccessToken(token string)

SetAccessToken sets saved token to current client

func (*Client) SetHTTPClient

func (c *Client) SetHTTPClient(client *http.Client)

SetHTTPClient sets *http.Client to current client

func (*Client) SetLog

func (c *Client) SetLog(log io.Writer)

SetLog will set/change the output destination. If log file is set paypal will log all requests and responses to this Writer

func (*Client) SetWebProfile

func (c *Client) SetWebProfile(wp WebProfile) error

SetWebProfile sets a web experience profile in Paypal with given id

Endpoint: PUT /v1/payment-experience/web-profiles

func (*Client) StoreCreditCard

func (c *Client) StoreCreditCard(cc CreditCard) (*CreditCard, error)

StoreCreditCard func Endpoint: POST /v1/vault/credit-cards

func (*Client) UpdateOrder

func (c *Client) UpdateOrder(orderID string, purchaseUnits []PurchaseUnitRequest) (*Order, error)

UpdateOrder updates the order by ID Endpoint: PATCH /v2/checkout/orders/ID

func (*Client) VoidAuthorization

func (c *Client) VoidAuthorization(authID string) (*Authorization, error)

VoidAuthorization voids a previously authorized payment Endpoint: POST /v2/payments/authorization/ID/void

type CreateAgreementResp

type CreateAgreementResp struct {
	Name        string      `json:"name,omitempty"`
	Description string      `json:"description,omitempty"`
	Plan        BillingPlan `json:"plan,omitempty"`
	Links       []Link      `json:"links,omitempty"`
	StartTime   time.Time   `json:"start_time,omitempty"`
}

CreateAgreementResp struct

type CreateBillingResp

type CreateBillingResp struct {
	ID                  string              `json:"id,omitempty"`
	State               string              `json:"state,omitempty"`
	PaymentDefinitions  []PaymentDefinition `json:"payment_definitions,omitempty"`
	MerchantPreferences MerchantPreferences `json:"merchant_preferences,omitempty"`
	CreateTime          time.Time           `json:"create_time,omitempty"`
	UpdateTime          time.Time           `json:"update_time,omitempty"`
	Links               []Link              `json:"links,omitempty"`
}

CreateBillingResp struct

type CreateOrderPayer

type CreateOrderPayer struct {
	Name         *CreateOrderPayerName          `json:"name,omitempty"`
	EmailAddress string                         `json:"email_address,omitempty"`
	PayerID      string                         `json:"payer_id,omitempty"`
	Phone        *PhoneWithType                 `json:"phone,omitempty"`
	BirthDate    string                         `json:"birth_date,omitempty"`
	TaxInfo      *TaxInfo                       `json:"tax_info,omitempty"`
	Address      *ShippingDetailAddressPortable `json:"address,omitempty"`
}

CreateOrderPayer used with create order requests

type CreateOrderPayerName

type CreateOrderPayerName struct {
	GivenName string `json:"given_name,omitempty"`
	Surname   string `json:"surname,omitempty"`
}

CreateOrderPayerName create order payer name

type CreditCard

type CreditCard struct {
	ID                 string   `json:"id,omitempty"`
	PayerID            string   `json:"payer_id,omitempty"`
	ExternalCustomerID string   `json:"external_customer_id,omitempty"`
	Number             string   `json:"number"`
	Type               string   `json:"type"`
	ExpireMonth        string   `json:"expire_month"`
	ExpireYear         string   `json:"expire_year"`
	CVV2               string   `json:"cvv2,omitempty"`
	FirstName          string   `json:"first_name,omitempty"`
	LastName           string   `json:"last_name,omitempty"`
	BillingAddress     *Address `json:"billing_address,omitempty"`
	State              string   `json:"state,omitempty"`
	ValidUntil         string   `json:"valid_until,omitempty"`
}

CreditCard struct

type CreditCardField

type CreditCardField struct {
	Operation string `json:"op"`
	Path      string `json:"path"`
	Value     string `json:"value"`
}

CreditCardField PATCH /v1/vault/credit-cards/credit_card_id

type CreditCardToken

type CreditCardToken struct {
	CreditCardID string `json:"credit_card_id"`
	PayerID      string `json:"payer_id,omitempty"`
	Last4        string `json:"last4,omitempty"`
	ExpireYear   string `json:"expire_year,omitempty"`
	ExpireMonth  string `json:"expire_month,omitempty"`
}

CreditCardToken struct

type CreditCards

type CreditCards struct {
	Items      []CreditCard `json:"items"`
	Links      []Link       `json:"links"`
	TotalItems int          `json:"total_items"`
	TotalPages int          `json:"total_pages"`
}

CreditCards GET /v1/vault/credit-cards

type CreditCardsFilter

type CreditCardsFilter struct {
	PageSize int
	Page     int
}

CreditCardsFilter struct

type Currency

type Currency struct {
	Currency string `json:"currency,omitempty"`
	Value    string `json:"value,omitempty"`
}

Currency struct

type Details

type Details struct {
	Subtotal         string `json:"subtotal,omitempty"`
	Shipping         string `json:"shipping,omitempty"`
	Tax              string `json:"tax,omitempty"`
	HandlingFee      string `json:"handling_fee,omitempty"`
	ShippingDiscount string `json:"shipping_discount,omitempty"`
	Insurance        string `json:"insurance,omitempty"`
	GiftWrap         string `json:"gift_wrap,omitempty"`
}

Details structure used in Amount structures as optional value

type ErrorResponse

type ErrorResponse struct {
	Response        *http.Response        `json:"-"`
	Name            string                `json:"name"`
	DebugID         string                `json:"debug_id"`
	Message         string                `json:"message"`
	InformationLink string                `json:"information_link"`
	Details         []ErrorResponseDetail `json:"details"`
}

ErrorResponse https://developer.paypal.com/docs/api/errors/

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

Error method implementation for ErrorResponse struct

type ErrorResponseDetail

type ErrorResponseDetail struct {
	Field string `json:"field"`
	Issue string `json:"issue"`
	Links []Link `json:"link"`
}

ErrorResponseDetail struct

type ExecuteAgreementResponse

type ExecuteAgreementResponse struct {
	ID               string           `json:"id"`
	State            string           `json:"state"`
	Description      string           `json:"description,omitempty"`
	Payer            Payer            `json:"payer"`
	Plan             BillingPlan      `json:"plan"`
	StartDate        time.Time        `json:"start_date"`
	ShippingAddress  ShippingAddress  `json:"shipping_address"`
	AgreementDetails AgreementDetails `json:"agreement_details"`
	Links            []Link           `json:"links"`
}

ExecuteAgreementResponse struct

type ExecuteResponse

type ExecuteResponse struct {
	ID           string        `json:"id"`
	Links        []Link        `json:"links"`
	State        string        `json:"state"`
	Payer        PaymentPayer  `json:"payer"`
	Transactions []Transaction `json:"transactions,omitempty"`
}

ExecuteResponse struct

type Filter

type Filter struct {
	// contains filtered or unexported fields
}

Filter type

func (*Filter) AddTextField

func (s *Filter) AddTextField(field string) *TextField

AddTextField .

func (*Filter) AddTimeField

func (s *Filter) AddTimeField(field string) *TimeField

AddTimeField .

func (*Filter) String

func (s *Filter) String() string

type FlowConfig

type FlowConfig struct {
	LandingPageType   string `json:"landing_page_type,omitempty"`
	BankTXNPendingURL string `json:"bank_txn_pending_url,omitempty"`
	UserAction        string `json:"user_action,omitempty"`
}

FlowConfig represents the general behaviour of redirect payment pages

https://developer.paypal.com/docs/api/payment-experience/#definition-flow_config

type FundingInstrument

type FundingInstrument struct {
	CreditCard      *CreditCard      `json:"credit_card,omitempty"`
	CreditCardToken *CreditCardToken `json:"credit_card_token,omitempty"`
}

FundingInstrument struct

type InputFields

type InputFields struct {
	AllowNote       bool `json:"allow_note,omitempty"`
	NoShipping      uint `json:"no_shipping,omitempty"`
	AddressOverride uint `json:"address_override,omitempty"`
}

InputFields represents the fields that are displayed to a customer on redirect payments

https://developer.paypal.com/docs/api/payment-experience/#definition-input_fields

type Item

type Item struct {
	Quantity    uint32 `json:"quantity"`
	Name        string `json:"name"`
	Price       string `json:"price"`
	Currency    string `json:"currency"`
	SKU         string `json:"sku,omitempty"`
	Description string `json:"description,omitempty"`
	Tax         string `json:"tax,omitempty"`
	UnitAmount  *Money `json:"unit_amount,omitempty"`
	Category    string `json:"category,omitempty"`
}

Item struct

type ItemList

type ItemList struct {
	Items           []Item           `json:"items,omitempty"`
	ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
}

ItemList struct

type JSONTime

type JSONTime time.Time

JSONTime overrides MarshalJson method to format in ISO8601

func (JSONTime) MarshalJSON

func (t JSONTime) MarshalJSON() ([]byte, error)

MarshalJSON for JSONTime

type Link struct {
	Href    string `json:"href"`
	Rel     string `json:"rel,omitempty"`
	Method  string `json:"method,omitempty"`
	Enctype string `json:"enctype,omitempty"`
}

Link struct

type MerchantPreferences

type MerchantPreferences struct {
	SetupFee                *AmountPayout `json:"setup_fee,omitempty"`
	ReturnURL               string        `json:"return_url,omitempty"`
	CancelURL               string        `json:"cancel_url,omitempty"`
	AutoBillAmount          string        `json:"auto_bill_amount,omitempty"`
	InitialFailAmountAction string        `json:"initial_fail_amount_action,omitempty"`
	MaxFailAttempts         string        `json:"max_fail_attempts,omitempty"`
}

MerchantPreferences struct

type Money

type Money struct {
	Currency string `json:"currency_code"`
	Value    string `json:"value"`
}

Money struct

https://developer.paypal.com/docs/api/orders/v2/#definition-money

type Name

type Name struct {
	FullName string `json:"full_name,omitempty"`
}

Name struct

type Order

type Order struct {
	ID            string         `json:"id,omitempty"`
	Status        string         `json:"status,omitempty"`
	Intent        string         `json:"intent,omitempty"`
	PurchaseUnits []PurchaseUnit `json:"purchase_units,omitempty"`
	Links         []Link         `json:"links,omitempty"`
	CreateTime    *time.Time     `json:"create_time,omitempty"`
	UpdateTime    *time.Time     `json:"update_time,omitempty"`
}

Order struct

type Payee added in v1.0.2

type Payee struct {
	Email string `json:"email"`
}

Payee struct

type PayeeForOrders

type PayeeForOrders struct {
	EmailAddress string `json:"email_address,omitempty"`
	MerchantID   string `json:"merchant_id,omitempty"`
}

PayeeForOrders struct

type Payer

type Payer struct {
	PaymentMethod      string              `json:"payment_method"`
	FundingInstruments []FundingInstrument `json:"funding_instruments,omitempty"`
	PayerInfo          *PayerInfo          `json:"payer_info,omitempty"`
	Status             string              `json:"payer_status,omitempty"`
}

Payer struct

type PayerInfo

type PayerInfo struct {
	Email           string           `json:"email,omitempty"`
	FirstName       string           `json:"first_name,omitempty"`
	LastName        string           `json:"last_name,omitempty"`
	PayerID         string           `json:"payer_id,omitempty"`
	Phone           string           `json:"phone,omitempty"`
	ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
	TaxIDType       string           `json:"tax_id_type,omitempty"`
	TaxID           string           `json:"tax_id,omitempty"`
	CountryCode     string           `json:"country_code"`
}

PayerInfo struct

type PayerWithNameAndPhone

type PayerWithNameAndPhone struct {
	Name         *CreateOrderPayerName `json:"name,omitempty"`
	EmailAddress string                `json:"email_address,omitempty"`
	Phone        *PhoneWithType        `json:"phone,omitempty"`
	PayerID      string                `json:"payer_id,omitempty"`
}

PayerWithNameAndPhone struct

type PaymentDefinition

type PaymentDefinition struct {
	ID                string        `json:"id,omitempty"`
	Name              string        `json:"name,omitempty"`
	Type              string        `json:"type,omitempty"`
	Frequency         string        `json:"frequency,omitempty"`
	FrequencyInterval string        `json:"frequency_interval,omitempty"`
	Amount            AmountPayout  `json:"amount,omitempty"`
	Cycles            string        `json:"cycles,omitempty"`
	ChargeModels      []ChargeModel `json:"charge_models,omitempty"`
}

PaymentDefinition struct

type PaymentOptions added in v1.0.1

type PaymentOptions struct {
	AllowedPaymentMethod string `json:"allowed_payment_method,omitempty"`
}

PaymentOptions struct

type PaymentPatch added in v1.0.1

type PaymentPatch struct {
	Operation string      `json:"op"`
	Path      string      `json:"path"`
	Value     interface{} `json:"value"`
}

PaymentPatch PATCH /v2/payments/payment/{payment_id)

type PaymentPayer added in v1.0.1

type PaymentPayer struct {
	PaymentMethod string     `json:"payment_method"`
	Status        string     `json:"status,omitempty"`
	PayerInfo     *PayerInfo `json:"payer_info,omitempty"`
}

PaymentPayer struct

type PaymentResponse

type PaymentResponse struct {
	ID           string        `json:"id"`
	State        string        `json:"state"`
	Intent       string        `json:"intent"`
	Payer        Payer         `json:"payer"`
	Transactions []Transaction `json:"transactions"`
	Links        []Link        `json:"links"`
}

PaymentResponse structure

type PaymentSource

type PaymentSource struct {
	Card  *PaymentSourceCard  `json:"card"`
	Token *PaymentSourceToken `json:"token"`
}

PaymentSource structure

type PaymentSourceCard

type PaymentSourceCard struct {
	ID             string              `json:"id"`
	Name           string              `json:"name"`
	Number         string              `json:"number"`
	Expiry         string              `json:"expiry"`
	SecurityCode   string              `json:"security_code"`
	LastDigits     string              `json:"last_digits"`
	CardType       string              `json:"card_type"`
	BillingAddress *CardBillingAddress `json:"billing_address"`
}

PaymentSourceCard structure

type PaymentSourceToken

type PaymentSourceToken struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

PaymentSourceToken structure

type Payout

type Payout struct {
	SenderBatchHeader *SenderBatchHeader `json:"sender_batch_header"`
	Items             []PayoutItem       `json:"items"`
}

Payout struct

type PayoutItem

type PayoutItem struct {
	RecipientType string        `json:"recipient_type"`
	Receiver      string        `json:"receiver"`
	Amount        *AmountPayout `json:"amount"`
	Note          string        `json:"note,omitempty"`
	SenderItemID  string        `json:"sender_item_id,omitempty"`
}

PayoutItem struct

type PayoutItemResponse

type PayoutItemResponse struct {
	PayoutItemID      string        `json:"payout_item_id"`
	TransactionID     string        `json:"transaction_id"`
	TransactionStatus string        `json:"transaction_status"`
	PayoutBatchID     string        `json:"payout_batch_id,omitempty"`
	PayoutItemFee     *AmountPayout `json:"payout_item_fee,omitempty"`
	PayoutItem        *PayoutItem   `json:"payout_item"`
	TimeProcessed     *time.Time    `json:"time_processed,omitempty"`
	Links             []Link        `json:"links"`
	Error             ErrorResponse `json:"errors,omitempty"`
}

PayoutItemResponse struct

type PayoutResponse

type PayoutResponse struct {
	BatchHeader *BatchHeader         `json:"batch_header"`
	Items       []PayoutItemResponse `json:"items"`
	Links       []Link               `json:"links"`
}

PayoutResponse struct

type PhoneWithType

type PhoneWithType struct {
	PhoneType   string               `json:"phone_type,omitempty"`
	PhoneNumber *PhoneWithTypeNumber `json:"phone_number,omitempty"`
}

PhoneWithType struct used for orders

type PhoneWithTypeNumber

type PhoneWithTypeNumber struct {
	NationalNumber string `json:"national_number,omitempty"`
}

PhoneWithTypeNumber struct for PhoneWithType

type Presentation

type Presentation struct {
	BrandName  string `json:"brand_name,omitempty"`
	LogoImage  string `json:"logo_image,omitempty"`
	LocaleCode string `json:"locale_code,omitempty"`
}

Presentation represents the branding and locale that a customer sees on redirect payments

https://developer.paypal.com/docs/api/payment-experience/#definition-presentation

type PurchaseUnit

type PurchaseUnit struct {
	ReferenceID string              `json:"reference_id"`
	Amount      *PurchaseUnitAmount `json:"amount,omitempty"`
}

PurchaseUnit struct

type PurchaseUnitAmount

type PurchaseUnitAmount struct {
	Currency  string                       `json:"currency_code"`
	Value     string                       `json:"value"`
	Breakdown *PurchaseUnitAmountBreakdown `json:"breakdown,omitempty"`
}

PurchaseUnitAmount struct

type PurchaseUnitAmountBreakdown

type PurchaseUnitAmountBreakdown struct {
	ItemTotal        *Money `json:"item_total,omitempty"`
	Shipping         *Money `json:"shipping,omitempty"`
	Handling         *Money `json:"handling,omitempty"`
	TaxTotal         *Money `json:"tax_total,omitempty"`
	Insurance        *Money `json:"insurance,omitempty"`
	ShippingDiscount *Money `json:"shipping_discount,omitempty"`
	Discount         *Money `json:"discount,omitempty"`
}

PurchaseUnitAmountBreakdown struct

type PurchaseUnitRequest

type PurchaseUnitRequest struct {
	ReferenceID    string              `json:"reference_id,omitempty"`
	Amount         *PurchaseUnitAmount `json:"amount"`
	Payee          *PayeeForOrders     `json:"payee,omitempty"`
	Description    string              `json:"description,omitempty"`
	CustomID       string              `json:"custom_id,omitempty"`
	InvoiceID      string              `json:"invoice_id,omitempty"`
	SoftDescriptor string              `json:"soft_descriptor,omitempty"`
	Items          []Item              `json:"items,omitempty"`
	Shipping       *ShippingDetail     `json:"shipping,omitempty"`
}

PurchaseUnitRequest struct

type RedirectURLs

type RedirectURLs struct {
	ReturnURL string `json:"return_url,omitempty"`
	CancelURL string `json:"cancel_url,omitempty"`
}

RedirectURLs struct

type Refund

type Refund struct {
	ID            string     `json:"id,omitempty"`
	Amount        *Amount    `json:"amount,omitempty"`
	CreateTime    *time.Time `json:"create_time,omitempty"`
	State         string     `json:"state,omitempty"`
	CaptureID     string     `json:"capture_id,omitempty"`
	ParentPayment string     `json:"parent_payment,omitempty"`
	UpdateTime    *time.Time `json:"update_time,omitempty"`
}

Refund struct

type RefundResponse

type RefundResponse struct {
	ID     string              `json:"id,omitempty"`
	Amount *PurchaseUnitAmount `json:"amount,omitempty"`
	Status string              `json:"status,omitempty"`
}

RefundResponse .

type Related struct {
	Sale          *Sale          `json:"sale,omitempty"`
	Authorization *Authorization `json:"authorization,omitempty"`
	Order         *Order         `json:"order,omitempty"`
	Capture       *Capture       `json:"capture,omitempty"`
	Refund        *Refund        `json:"refund,omitempty"`
}

Related struct

type Sale

type Sale struct {
	ID                        string     `json:"id,omitempty"`
	Amount                    *Amount    `json:"amount,omitempty"`
	TransactionFee            *Currency  `json:"transaction_fee,omitempty"`
	Description               string     `json:"description,omitempty"`
	CreateTime                *time.Time `json:"create_time,omitempty"`
	State                     string     `json:"state,omitempty"`
	ParentPayment             string     `json:"parent_payment,omitempty"`
	UpdateTime                *time.Time `json:"update_time,omitempty"`
	PaymentMode               string     `json:"payment_mode,omitempty"`
	PendingReason             string     `json:"pending_reason,omitempty"`
	ReasonCode                string     `json:"reason_code,omitempty"`
	ClearingTime              string     `json:"clearing_time,omitempty"`
	ProtectionEligibility     string     `json:"protection_eligibility,omitempty"`
	ProtectionEligibilityType string     `json:"protection_eligibility_type,omitempty"`
	Links                     []Link     `json:"links,omitempty"`
}

Sale struct

type SenderBatchHeader

type SenderBatchHeader struct {
	EmailSubject  string `json:"email_subject"`
	SenderBatchID string `json:"sender_batch_id,omitempty"`
}

SenderBatchHeader struct

type ShippingAddress

type ShippingAddress struct {
	RecipientName string `json:"recipient_name,omitempty"`
	Type          string `json:"type,omitempty"`
	Line1         string `json:"line1"`
	Line2         string `json:"line2,omitempty"`
	City          string `json:"city"`
	CountryCode   string `json:"country_code"`
	PostalCode    string `json:"postal_code,omitempty"`
	State         string `json:"state,omitempty"`
	Phone         string `json:"phone,omitempty"`
}

ShippingAddress struct

type ShippingDetail

type ShippingDetail struct {
	Name    *Name                          `json:"name,omitempty"`
	Address *ShippingDetailAddressPortable `json:"address,omitempty"`
}

ShippingDetail struct

type ShippingDetailAddressPortable

type ShippingDetailAddressPortable struct {
	AddressLine1 string `json:"address_line_1,omitempty"`
	AddressLine2 string `json:"address_line_2,omitempty"`
	AdminArea1   string `json:"admin_area_1,omitempty"`
	AdminArea2   string `json:"admin_area_2,omitempty"`
	PostalCode   string `json:"postal_code,omitempty"`
	CountryCode  string `json:"country_code,omitempty"`
}

ShippingDetailAddressPortable used with create orders

type TaxInfo

type TaxInfo struct {
	TaxID     string `json:"tax_id,omitempty"`
	TaxIDType string `json:"tax_id_type,omitempty"`
}

TaxInfo used for orders.

type TextField

type TextField struct {
	Is string
	// contains filtered or unexported fields
}

TextField type

func (TextField) String

func (d TextField) String() string

type TimeField

type TimeField struct {
	Is time.Time
	// contains filtered or unexported fields
}

TimeField type

func (TimeField) String

func (d TimeField) String() string

String .

type TokenResponse

type TokenResponse struct {
	RefreshToken string         `json:"refresh_token"`
	Token        string         `json:"access_token"`
	Type         string         `json:"token_type"`
	ExpiresIn    expirationTime `json:"expires_in"`
}

TokenResponse is for API response for the /oauth2/token endpoint

type Transaction

type Transaction struct {
	Amount           *Amount         `json:"amount"`
	Description      string          `json:"description,omitempty"`
	ItemList         *ItemList       `json:"item_list,omitempty"`
	InvoiceNumber    string          `json:"invoice_number,omitempty"`
	Custom           string          `json:"custom,omitempty"`
	SoftDescriptor   string          `json:"soft_descriptor,omitempty"`
	RelatedResources []Related       `json:"related_resources,omitempty"`
	PaymentOptions   *PaymentOptions `json:"payment_options,omitempty"`
	NotifyURL        string          `json:"notify_url,omitempty"`
	OrderURL         string          `json:"order_url,omitempty"`
	Payee            *Payee          `json:"payee,omitempty"`
}

Transaction struct

type UserInfo

type UserInfo struct {
	ID              string   `json:"user_id"`
	Name            string   `json:"name"`
	GivenName       string   `json:"given_name"`
	FamilyName      string   `json:"family_name"`
	Email           string   `json:"email"`
	Verified        bool     `json:"verified,omitempty,string"`
	Gender          string   `json:"gender,omitempty"`
	BirthDate       string   `json:"birthdate,omitempty"`
	ZoneInfo        string   `json:"zoneinfo,omitempty"`
	Locale          string   `json:"locale,omitempty"`
	Phone           string   `json:"phone_number,omitempty"`
	Address         *Address `json:"address,omitempty"`
	VerifiedAccount bool     `json:"verified_account,omitempty,string"`
	AccountType     string   `json:"account_type,omitempty"`
	AgeRange        string   `json:"age_range,omitempty"`
	PayerID         string   `json:"payer_id,omitempty"`
}

UserInfo struct

type WebProfile

type WebProfile struct {
	ID           string       `json:"id,omitempty"`
	Name         string       `json:"name"`
	Presentation Presentation `json:"presentation,omitempty"`
	InputFields  InputFields  `json:"input_fields,omitempty"`
	FlowConfig   FlowConfig   `json:"flow_config,omitempty"`
}

WebProfile represents the configuration of the payment web payment experience

https://developer.paypal.com/docs/api/payment-experience/

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL