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.
Index ¶
- Constants
- type Address
- type AggregatedDiscount
- type AgreementDetails
- type Amount
- type AmountPayout
- type AmountSummaryDetail
- type AmountWithBreakdown
- type AnyEvent
- type ApplicationContext
- type Authorization
- type AuthorizeOrderRequest
- type AuthorizeOrderResponse
- type BatchHeader
- type BillingCycle
- type BillingCycleOverride
- type BillingInfo
- type BillingPlan
- type BillingPlanStatus
- type Capture
- type CaptureAmount
- type CaptureDetailsResponse
- type CaptureOrderMockResponse
- type CaptureOrderRequest
- type CaptureOrderResponse
- type CaptureRequest
- type CaptureSellerBreakdown
- type CaptureStatusDetails
- type CaptureType
- type CapturedPayments
- type CapturedPurchaseItem
- type CapturedPurchaseUnit
- type CapturedPurchaseUnitShipping
- type CardBillingAddress
- type ChargeModel
- type Client
- func (c *Client) ActivateSubscription(ctx context.Context, subscriptionId, activateReason string) error
- func (c *Client) ActivateSubscriptionPlan(ctx context.Context, planId string) error
- func (c *Client) AuthorizeOrder(ctx context.Context, orderID string, ...) (*AuthorizeOrderResponse, error)
- func (c *Client) CancelPayoutItem(ctx context.Context, payoutItemID string) (*PayoutItemResponse, error)
- func (c *Client) CancelSubscription(ctx context.Context, subscriptionId, cancelReason string) error
- func (c *Client) CaptureAuthorization(ctx context.Context, authID string, ...) (*PaymentCaptureResponse, error)
- func (c *Client) CaptureAuthorizationWithPaypalRequestId(ctx context.Context, authID string, ...) (*PaymentCaptureResponse, error)
- func (c *Client) CaptureOrder(ctx context.Context, orderID string, captureOrderRequest CaptureOrderRequest) (*CaptureOrderResponse, error)
- func (c *Client) CaptureOrderWithPaypalRequestId(ctx context.Context, orderID string, captureOrderRequest CaptureOrderRequest, ...) (*CaptureOrderResponse, error)
- func (c *Client) CaptureSubscription(ctx context.Context, subscriptionId string, request CaptureRequest) (*SubscriptionCaptureResponse, error)
- func (c *Client) CapturedDetail(ctx context.Context, captureID string) (*CaptureDetailsResponse, error)
- func (c *Client) CreateOrder(ctx context.Context, intent string, purchaseUnits []PurchaseUnitRequest, ...) (*Order, error)
- func (c *Client) CreateOrderWithPaypalRequestID(ctx context.Context, intent string, purchaseUnits []PurchaseUnitRequest, ...) (*Order, error)
- func (c *Client) CreatePayout(ctx context.Context, p Payout) (*PayoutResponse, error)
- func (c *Client) CreateProduct(ctx context.Context, product Product) (*CreateProductResponse, error)
- func (c *Client) CreateSubscription(ctx context.Context, newSubscription SubscriptionBase) (*SubscriptionDetailResp, error)
- func (c *Client) CreateSubscriptionPlan(ctx context.Context, newPlan SubscriptionPlan) (*CreateSubscriptionPlanResponse, error)
- func (c *Client) CreateWebProfile(ctx context.Context, wp WebProfile) (*WebProfile, error)
- func (c *Client) CreateWebhook(ctx context.Context, createWebhookRequest *CreateWebhookRequest) (*Webhook, error)
- func (c *Client) DeactivateSubscriptionPlans(ctx context.Context, planId string) error
- func (c *Client) DeleteCreditCard(ctx context.Context, id string) error
- func (c *Client) DeleteWebProfile(ctx context.Context, profileID string) error
- func (c *Client) DeleteWebhook(ctx context.Context, webhookID string) error
- func (c *Client) GenerateInvoiceNumber(ctx context.Context) (*InvoiceNumber, error)
- func (c *Client) GetAccessToken(ctx context.Context) (*TokenResponse, error)
- func (c *Client) GetAuthorization(ctx context.Context, authID string) (*Authorization, error)
- func (c *Client) GetCreditCard(ctx context.Context, id string) (*CreditCard, error)
- func (c *Client) GetCreditCards(ctx context.Context, ccf *CreditCardsFilter) (*CreditCards, error)
- func (c *Client) GetInvoiceDetails(ctx context.Context, invoiceID string) (*Invoice, error)
- func (c *Client) GetOrder(ctx context.Context, orderID string) (*Order, error)
- func (c *Client) GetPayout(ctx context.Context, payoutBatchID string) (*PayoutResponse, error)
- func (c *Client) GetPayoutItem(ctx context.Context, payoutItemID string) (*PayoutItemResponse, error)
- func (c *Client) GetProduct(ctx context.Context, productId string) (*Product, error)
- func (c *Client) GetRefund(ctx context.Context, refundID string) (*Refund, error)
- func (c *Client) GetSubscriptionDetails(ctx context.Context, subscriptionID string) (*SubscriptionDetailResp, error)
- func (c *Client) GetSubscriptionPlan(ctx context.Context, planId string) (*SubscriptionPlan, error)
- func (c *Client) GetSubscriptionTransactions(ctx context.Context, requestParams SubscriptionTransactionsParams) (*SubscriptionTransactionsResponse, error)
- func (c *Client) GetUserInfo(ctx context.Context, schema string) (*UserInfo, error)
- func (c *Client) GetWebProfile(ctx context.Context, profileID string) (*WebProfile, error)
- func (c *Client) GetWebProfiles(ctx context.Context) ([]WebProfile, error)
- func (c *Client) GetWebhook(ctx context.Context, webhookID string) (*Webhook, error)
- func (c *Client) GetWebhookEventTypes(ctx context.Context) (*WebhookEventTypesResponse, error)
- func (c *Client) ListProducts(ctx context.Context, params *ProductListParameters) (*ListProductsResponse, error)
- func (c *Client) ListSubscriptionPlans(ctx context.Context, params *SubscriptionPlanListParameters) (*ListSubscriptionPlansResponse, error)
- func (c *Client) ListTransactions(ctx context.Context, req *TransactionSearchRequest) (*TransactionSearchResponse, error)
- func (c *Client) ListWebhooks(ctx context.Context, anchorType string) (*ListWebhookResponse, error)
- func (c *Client) NewRequest(ctx context.Context, method, url string, payload interface{}) (*http.Request, error)
- func (c *Client) PatchCreditCard(ctx context.Context, id string, ccf []CreditCardField) (*CreditCard, error)
- func (c *Client) ReauthorizeAuthorization(ctx context.Context, authID string, a *Amount) (*Authorization, error)
- func (c *Client) RefundCapture(ctx context.Context, captureID string, ...) (*RefundResponse, error)
- func (c *Client) RefundCaptureWithPaypalRequestId(ctx context.Context, captureID string, ...) (*RefundResponse, error)
- func (c *Client) ReviseSubscription(ctx context.Context, subscriptionId string, ...) (*SubscriptionDetailResp, error)
- func (c *Client) Send(req *http.Request, v interface{}) error
- func (c *Client) SendWithAuth(req *http.Request, v interface{}) error
- func (c *Client) SendWithBasicAuth(req *http.Request, v interface{}) error
- func (c *Client) SetAccessToken(token string)
- func (c *Client) SetHTTPClient(client *http.Client)
- func (c *Client) SetLog(log io.Writer)
- func (c *Client) SetReturnRepresentation()
- func (c *Client) SetWebProfile(ctx context.Context, wp WebProfile) error
- func (c *Client) StoreCreditCard(ctx context.Context, cc CreditCard) (*CreditCard, error)
- func (c *Client) SuspendSubscription(ctx context.Context, subscriptionId, reason string) error
- func (c *Client) UpdateOrder(ctx context.Context, orderID string, op string, path string, ...) error
- func (c *Client) UpdateProduct(ctx context.Context, product Product) error
- func (c *Client) UpdateSubscription(ctx context.Context, updatedSubscription Subscription) error
- func (c *Client) UpdateSubscriptionPlan(ctx context.Context, updatedPlan SubscriptionPlan) error
- func (c *Client) UpdateSubscriptionPlanPricing(ctx context.Context, planId string, pricingSchemes []PricingSchemeUpdate) error
- func (c *Client) UpdateWebhook(ctx context.Context, webhookID string, fields []WebhookField) (*Webhook, error)
- func (c *Client) VerifyWebhookSignature(ctx context.Context, httpReq *http.Request, webhookID string) (*VerifyWebhookResponse, error)
- func (c *Client) VoidAuthorization(ctx context.Context, authID string) (*Authorization, error)
- type Consent
- type CreateOrderPayer
- type CreateOrderPayerName
- type CreateProductResponse
- type CreateSubscriptionPlanResponse
- type CreateWebhookRequest
- type CreditCard
- type CreditCardField
- type CreditCardToken
- type CreditCards
- type CreditCardsFilter
- type Currency
- type CustomAmount
- type CycleExecutions
- type Details
- type ErrorResponse
- type ErrorResponseDetail
- type Event
- type ExchangeRate
- type ExecuteAgreementResponse
- type ExecuteResponse
- type Filter
- type FlowConfig
- type Frequency
- type FundingInstrument
- type InputFields
- type IntegrationDetails
- type IntervalUnit
- type Invoice
- type InvoiceAddressDetails
- type InvoiceAddressPortable
- type InvoiceAmountWithBreakdown
- type InvoiceAuditMetadata
- type InvoiceBillingInfo
- type InvoiceConfiguration
- type InvoiceContactInfo
- type InvoiceDetail
- type InvoiceEmailAddress
- type InvoiceFileReference
- type InvoiceItem
- type InvoiceNumber
- type InvoicePartialPayment
- type InvoicePaymentDetails
- type InvoicePaymentTerm
- type InvoicePayments
- type InvoiceRecipientInfo
- type InvoiceRefund
- type InvoiceRefundDetails
- type InvoiceShippingCost
- type InvoiceTax
- type InvoicerInfo
- type InvoicerPhoneDetail
- type InvoicingDiscount
- type Item
- type ItemList
- type JSONTime
- type LastPayment
- type Link
- type ListParams
- type ListProductsResponse
- type ListSubscriptionPlansResponse
- type ListWebhookResponse
- type MerchantPreferences
- type Money
- type Name
- type Operation
- type Order
- type PartnerConfigOverride
- type Patch
- type Payee
- type PayeeForOrders
- type PayeePreferred
- type Payer
- type PayerInfo
- type PayerWithNameAndPhone
- type PaymentCaptureRequest
- type PaymentCaptureResponse
- type PaymentDefinition
- type PaymentInstruction
- type PaymentMethod
- type PaymentOptions
- type PaymentPatch
- type PaymentPayer
- type PaymentPreferences
- type PaymentPreferencesOverride
- type PaymentResponse
- type PaymentSource
- type PaymentSourceCard
- type PaymentSourcePaypal
- type PaymentSourcePaypalExperienceContext
- type PaymentSourceToken
- type Payout
- type PayoutItem
- type PayoutItemResponse
- type PayoutResponse
- type PhoneWithType
- type PhoneWithTypeNumber
- type Plan
- type PlanOverride
- type PlatformFee
- type Presentation
- type PricingScheme
- type PricingSchemeUpdate
- type PricingSchemeUpdateRequest
- type Product
- type ProductCategory
- type ProductListParameters
- type ProductType
- type PurchaseUnit
- type PurchaseUnitAmount
- type PurchaseUnitAmountBreakdown
- type PurchaseUnitRequest
- type RedirectURLs
- type ReferralRequest
- type ReferralResponse
- type Refund
- type RefundCaptureRequest
- type RefundResponse
- type Related
- type RestAPIIntegration
- type Sale
- type SearchCartInfo
- type SearchCheckoutOption
- type SearchItemDetails
- type SearchPayerInfo
- type SearchPayerName
- type SearchShippingInfo
- type SearchTaxAmount
- type SearchTransactionDetails
- type SearchTransactionInfo
- type SellerProtection
- type SellerReceivableBreakdown
- type SenderBatchHeader
- type SetupFeeFailureAction
- type SharedListResponse
- type SharedResponse
- type ShippingAddress
- type ShippingAmount
- type ShippingDetail
- type ShippingDetailAddressPortable
- type ShippingPreference
- type StandardEntryClassCode
- type Subscriber
- type Subscription
- type SubscriptionBase
- type SubscriptionCaptureResponse
- type SubscriptionDetailResp
- type SubscriptionDetails
- type SubscriptionPlan
- type SubscriptionPlanListParameters
- type SubscriptionPlanStatus
- type SubscriptionStatus
- type SubscriptionTransactionStatus
- type SubscriptionTransactionsParams
- type SubscriptionTransactionsResponse
- type TaxInfo
- type Taxes
- type TaxesOverride
- type TenureType
- type TextField
- type ThirdPartyDetails
- type TimeField
- type TokenResponse
- type Transaction
- type TransactionSearchRequest
- type TransactionSearchResponse
- type UserAction
- type UserInfo
- type VerifyWebhookResponse
- type WebProfile
- type Webhook
- type WebhookEventType
- type WebhookEventTypesResponse
- type WebhookField
Constants ¶
const ( ProductTypePhysical ProductType = "PHYSICAL" ProductTypeDigital ProductType = "DIGITAL" ProductTypeService ProductType = "SERVICE" ProductCategorySoftware ProductCategory = "SOFTWARE" ProductCategorySoftwareComputerAndDataProcessingServices ProductCategory = "COMPUTER_AND_DATA_PROCESSING_SERVICES" ProductCategorySoftwareDigitalGames ProductCategory = "DIGITAL_GAMES" ProductCategorySoftwareGameSoftware ProductCategory = "GAME_SOFTWARE" ProductCategorySoftwareGames ProductCategory = "GAMES" ProductCategorySoftwareGeneral ProductCategory = "GENERAL" ProductCategorySoftwareGraphicAndCommercialDesign ProductCategory = "GRAPHIC_AND_COMMERCIAL_DESIGN" ProductCategorySoftwareOemSoftware ProductCategory = "OEM_SOFTWARE" ProductCategorySoftwareOnlineGaming ProductCategory = "ONLINE_GAMING" ProductCategorySoftwareOnlineGamingCurrency ProductCategory = "ONLINE_GAMING_CURRENCY" ProductCategorySoftwareOnlineServices ProductCategory = "ONLINE_SERVICES" ProductCategorySoftwareOther ProductCategory = "OTHER" ProductCategorySoftwareServices ProductCategory = "SERVICES" )
const ( // APIBaseSandBox points to the sandbox (for testing) version of the API APIBaseSandBox = "https://api-m.sandbox.paypal.com" // APIBaseLive points to the live version of the API APIBaseLive = "https://api-m.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 )
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
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
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
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
const ( OrderIntentCapture string = "CAPTURE" OrderIntentAuthorize string = "AUTHORIZE" )
Possible value for `intent` in CreateOrder
https://developer.paypal.com/docs/api/orders/v2/#orders_create
const ( OrderStatusCreated string = "CREATED" OrderStatusSaved string = "SAVED" OrderStatusApproved string = "APPROVED" OrderStatusVoided string = "VOIDED" OrderStatusCompleted string = "COMPLETED" )
Possible value for `status` in GetOrder
https://developer.paypal.com/docs/api/orders/v2/#orders-get-response
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
const ( EventCheckoutOrderApproved string = "CHECKOUT.ORDER.APPROVED" EventPaymentCaptureCompleted string = "PAYMENT.CAPTURE.COMPLETED" EventPaymentCaptureDenied string = "PAYMENT.CAPTURE.DENIED" EventPaymentCaptureRefunded string = "PAYMENT.CAPTURE.REFUNDED" EventMerchantOnboardingCompleted string = "MERCHANT.ONBOARDING.COMPLETED" EventMerchantPartnerConsentRevoked string = "MERCHANT.PARTNER-CONSENT.REVOKED" )
const ( OperationAPIIntegration string = "API_INTEGRATION" ProductExpressCheckout string = "EXPRESS_CHECKOUT" IntegrationMethodPayPal string = "PAYPAL" IntegrationTypeThirdParty string = "THIRD_PARTY" )
const ( FeaturePayment string = "PAYMENT" FeatureRefund string = "REFUND" FeatureFuturePayment string = "FUTURE_PAYMENT" FeatureDirectPayment string = "DIRECT_PAYMENT" FeaturePartnerFee string = "PARTNER_FEE" FeatureDelayFunds string = "DELAY_FUNDS_DISBURSEMENT" FeatureReadSellerDispute string = "READ_SELLER_DISPUTE" FeatureUpdateSellerDispute string = "UPDATE_SELLER_DISPUTE" FeatureDisputeReadBuyer string = "DISPUTE_READ_BUYER" FeatureUpdateCustomerDispute string = "UPDATE_CUSTOMER_DISPUTES" )
const ( EmailRecipientType string = "EMAIL" // An unencrypted email — string of up to 127 single-byte characters. PaypalIdRecipientType string = "PAYPAL_ID" // An encrypted PayPal account number. PhoneRecipientType string = "PHONE" // An unencrypted phone number. )
const ( PaypalRecipientWallet string = "PAYPAL" VenmoRecipientWallet string = "VENMO" )
const ( BatchStatusDenied string = "DENIED" BatchStatusPending string = "PENDING" BatchStatusProcessing string = "PROCESSING" BatchStatusSuccess string = "SUCCESS" BatchStatusCanceled string = "CANCELED" )
Possible value for `batch_status` in GetPayout
https://developer.paypal.com/docs/api/payments.payouts-batch/v1/#definition-batch_status
const ( LinkRelSelf string = "self" LinkRelActionURL string = "action_url" )
const ( AncorTypeApplication string = "APPLICATION" AncorTypeAccount string = "ACCOUNT" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { Line1 string `json:"line1,omitempty"` Line2 string `json:"line2,omitempty"` City string `json:"city,omitempty"` CountryCode string `json:"country_code,omitempty"` PostalCode string `json:"postal_code,omitempty"` State string `json:"state,omitempty"` Phone string `json:"phone,omitempty"` }
Address struct
type AggregatedDiscount ¶ added in v4.7.0
type AggregatedDiscount struct { InvoiceDiscount InvoicingDiscount `json:"invoice_discount,omitempty"` ItemDiscount *Money `json:"item_discount,omitempty"` }
Used in InvoiceAmountWithBreakdown Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-aggregated_discount
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 ¶
AmountPayout struct
type AmountSummaryDetail ¶ added in v4.7.0
type AmountSummaryDetail struct { Breakdown InvoiceAmountWithBreakdown `json:"breakdown,omitempty"` Currency string `json:"currency_code,omitempty"` Value string `json:"value,omitempty"` }
Invoice AmountSummary Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-amount_summary_detail
type AmountWithBreakdown ¶
type AmountWithBreakdown struct { GrossAmount Money `json:"gross_amount"` FeeAmount Money `json:"fee_amount"` ShippingAmount Money `json:"shipping_amount"` TaxAmount Money `json:"tax_amount"` NetAmount Money `json:"net_amount"` }
Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#definition-amount_with_breakdown
type AnyEvent ¶ added in v4.1.0
type AnyEvent struct { Event Resource json.RawMessage `json:"resource"` }
type ApplicationContext ¶
type ApplicationContext struct { BrandName string `json:"brand_name,omitempty"` Locale string `json:"locale,omitempty"` ShippingPreference ShippingPreference `json:"shipping_preference,omitempty"` UserAction UserAction `json:"user_action,omitempty"` PaymentMethod PaymentMethod `json:"payment_method,omitempty"` LandingPage string `json:"landing_page,omitempty"` ReturnURL string `json:"return_url,omitempty"` CancelURL string `json:"cancel_url,omitempty"` }
ApplicationContext struct Doc: https://developer.paypal.com/docs/api/orders/v2/#definition-application_context
type Authorization ¶
type Authorization struct { ID string `json:"id,omitempty"` CustomID string `json:"custom_id,omitempty"` InvoiceID string `json:"invoice_id,omitempty"` Status string `json:"status,omitempty"` StatusDetails *CaptureStatusDetails `json:"status_details,omitempty"` Amount *PurchaseUnitAmount `json:"amount,omitempty"` SellerProtection *SellerProtection `json:"seller_protection,omitempty"` CreateTime *time.Time `json:"create_time,omitempty"` UpdateTime *time.Time `json:"update_time,omitempty"` ExpirationTime *time.Time `json:"expiration_time,omitempty"` Links []Link `json:"links,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 []PurchaseUnit `json:"purchase_units,omitempty"` Payer *PayerWithNameAndPhone `json:"payer,omitempty"` }
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 BillingCycle ¶
type BillingCycle struct { PricingScheme PricingScheme `json:"pricing_scheme"` // The active pricing scheme for this billing cycle. A free trial billing cycle does not require a pricing scheme. Frequency Frequency `json:"frequency"` // The frequency details for this billing cycle. TenureType TenureType `json:"tenure_type"` // The tenure type of the billing cycle. In case of a plan having trial cycle, only 2 trial cycles are allowed per plan. The possible values are: Sequence int `json:"sequence"` // The order in which this cycle is to run among other billing cycles. For example, a trial billing cycle has a sequence of 1 while a regular billing cycle has a sequence of 2, so that trial cycle runs before the regular cycle. TotalCycles int `json:"total_cycles"` // The number of times this billing cycle gets executed. Trial billing cycles can only be executed a finite number of times (value between 1 and 999 for total_cycles). Regular billing cycles can be executed infinite times (value of 0 for total_cycles) or a finite number of times (value between 1 and 999 for total_cycles). }
Doc https://developer.paypal.com/docs/api/subscriptions/v1/#definition-billing_cycle
type BillingCycleOverride ¶ added in v4.5.0
type BillingCycleOverride struct { PricingScheme PricingScheme `json:"pricing_scheme,omitempty"` Sequence *int `json:"sequence,omitempty"` TotalCycles *int `json:"total_cycles,omitempty"` }
https://developer.paypal.com/docs/api/subscriptions/v1/#definition-billing_cycle_override
type BillingInfo ¶
type BillingInfo struct { OutstandingBalance AmountPayout `json:"outstanding_balance,omitempty"` CycleExecutions []CycleExecutions `json:"cycle_executions,omitempty"` LastPayment LastPayment `json:"last_payment,omitempty"` NextBillingTime time.Time `json:"next_billing_time,omitempty"` FailedPaymentsCount int `json:"failed_payments_count,omitempty"` }
BillingInfo 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 BillingPlanStatus ¶
type BillingPlanStatus string
const (
BillingPlanStatusActive BillingPlanStatus = "ACTIVE"
)
type Capture ¶
type Capture struct { ID string `json:"id,omitempty"` Amount *Amount `json:"amount,omitempty"` State string `json:"state,omitempty"` ParentPayment string `json:"parent_payment,omitempty"` TransactionFee string `json:"transaction_fee,omitempty"` IsFinalCapture bool `json:"is_final_capture"` CreateTime *time.Time `json:"create_time,omitempty"` UpdateTime *time.Time `json:"update_time,omitempty"` Links []Link `json:"links,omitempty"` }
Capture struct
type CaptureAmount ¶
type CaptureAmount struct { Status string `json:"status,omitempty"` ID string `json:"id,omitempty"` CustomID string `json:"custom_id,omitempty"` Amount *PurchaseUnitAmount `json:"amount,omitempty"` SellerProtection *SellerProtection `json:"seller_protection,omitempty"` SellerReceivableBreakdown *SellerReceivableBreakdown `json:"seller_receivable_breakdown,omitempty"` }
CaptureAmount struct
type CaptureDetailsResponse ¶ added in v4.1.0
type CaptureDetailsResponse struct { Status string `json:"status,omitempty"` StatusDetails *CaptureStatusDetails `json:"status_details,omitempty"` ID string `json:"id,omitempty"` Amount *Money `json:"amount,omitempty"` InvoiceID string `json:"invoice_id,omitempty"` CustomID string `json:"custom_id,omitempty"` SellerProtection *SellerProtection `json:"seller_protection,omitempty"` FinalCapture bool `json:"final_capture,omitempty"` SellerReceivableBreakdown *SellerReceivableBreakdown `json:"seller_receivable_breakdown,omitempty"` DisbursementMode string `json:"disbursement_mode,omitempty"` Links []Link `json:"links,omitempty"` UpdateTime *time.Time `json:"update_time,omitempty"` CreateTime *time.Time `json:"create_time,omitempty"` }
https://developer.paypal.com/docs/api/payments/v2/#captures_get
type CaptureOrderMockResponse ¶ added in v4.5.0
type CaptureOrderMockResponse struct {
MockApplicationCodes string `json:"mock_application_codes"`
}
CaptureOrderMockResponse - https://developer.paypal.com/docs/api-basics/sandbox/request-headers/#test-api-error-handling-routines
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"` Address *Address `json:"address,omitempty"` PurchaseUnits []CapturedPurchaseUnit `json:"purchase_units,omitempty"` }
CaptureOrderResponse is the response for capture order
type CaptureRequest ¶ added in v4.5.0
type CaptureRequest struct { Note string `json:"note"` CaptureType CaptureType `json:"capture_type"` Amount Money `json:"amount"` }
type CaptureSellerBreakdown ¶
type CaptureSellerBreakdown struct { GrossAmount PurchaseUnitAmount `json:"gross_amount"` PayPalFee PurchaseUnitAmount `json:"paypal_fee"` NetAmount PurchaseUnitAmount `json:"net_amount"` TotalRefundedAmount *PurchaseUnitAmount `json:"total_refunded_amount,omitempty"` }
type CaptureStatusDetails ¶
type CaptureStatusDetails struct {
Reason string `json:"reason,omitempty"`
}
https://developer.paypal.com/docs/api/payments/v2/#definition-capture_status_details
type CaptureType ¶
type CaptureType string
const (
CaptureTypeOutstandingBalance CaptureType = "OUTSTANDING_BALANCE"
)
type CapturedPayments ¶
type CapturedPayments struct { Autthorizations []Authorization `json:"authorizations,omitempty"` Captures []CaptureAmount `json:"captures,omitempty"` }
CapturedPayments has the amounts for a captured order
type CapturedPurchaseItem ¶
type CapturedPurchaseItem struct { Quantity string `json:"quantity"` Name string `json:"name"` SKU string `json:"sku,omitempty"` Description string `json:"description,omitempty"` }
CapturedPurchaseItem are items for a captured order
type CapturedPurchaseUnit ¶
type CapturedPurchaseUnit struct { Items []CapturedPurchaseItem `json:"items,omitempty"` ReferenceID string `json:"reference_id"` Shipping CapturedPurchaseUnitShipping `json:"shipping,omitempty"` Payments *CapturedPayments `json:"payments,omitempty"` }
CapturedPurchaseUnit are purchase units for a captured order
type CapturedPurchaseUnitShipping ¶
type CapturedPurchaseUnitShipping struct {
Address ShippingDetailAddressPortable `json:"address,omitempty"`
}
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 { 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 ¶
NewClient returns new Client struct APIBase is a base API URL, for testing you can use paypal.APIBaseSandBox
func (*Client) ActivateSubscription ¶
func (c *Client) ActivateSubscription(ctx context.Context, subscriptionId, activateReason string) error
Activates the subscription. Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_activate Endpoint: POST /v1/billing/subscriptions/{id}/activate
func (*Client) ActivateSubscriptionPlan ¶
Activates a plan Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#plans_activate Endpoint: POST /v1/billing/plans/{id}/activate
func (*Client) AuthorizeOrder ¶
func (c *Client) AuthorizeOrder(ctx context.Context, orderID string, authorizeOrderRequest AuthorizeOrderRequest) (*AuthorizeOrderResponse, 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(ctx context.Context, 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) CancelSubscription ¶
Cancels the subscription. Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_cancel Endpoint: POST /v1/billing/subscriptions/{id}/cancel
func (*Client) CaptureAuthorization ¶
func (c *Client) CaptureAuthorization(ctx context.Context, authID string, paymentCaptureRequest *PaymentCaptureRequest) (*PaymentCaptureResponse, 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/authorizations/ID/capture
func (*Client) CaptureAuthorizationWithPaypalRequestId ¶
func (c *Client) CaptureAuthorizationWithPaypalRequestId(ctx context.Context, authID string, paymentCaptureRequest *PaymentCaptureRequest, requestID string, ) (*PaymentCaptureResponse, error)
CaptureAuthorization captures and process an existing authorization with idempotency. To use this method, the original payment must have Intent set to "authorize" Endpoint: POST /v2/payments/authorizations/ID/capture
func (*Client) CaptureOrder ¶
func (c *Client) CaptureOrder(ctx context.Context, 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) CaptureOrderWithPaypalRequestId ¶
func (c *Client) CaptureOrderWithPaypalRequestId(ctx context.Context, orderID string, captureOrderRequest CaptureOrderRequest, requestID string, mockResponse *CaptureOrderMockResponse, ) (*CaptureOrderResponse, error)
CaptureOrder with idempotency - https://developer.paypal.com/docs/api/orders/v2/#orders_capture Endpoint: POST /v2/checkout/orders/ID/capture https://developer.paypal.com/docs/api/reference/api-requests/#http-request-headers
func (*Client) CaptureSubscription ¶
func (c *Client) CaptureSubscription(ctx context.Context, subscriptionId string, request CaptureRequest) (*SubscriptionCaptureResponse, error)
Captures an authorized payment from the subscriber on the subscription. Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_capture Endpoint: POST /v1/billing/subscriptions/{id}/capture
func (*Client) CapturedDetail ¶ added in v4.1.0
func (c *Client) CapturedDetail(ctx context.Context, captureID string) (*CaptureDetailsResponse, error)
CapturedDetail - https://developer.paypal.com/docs/api/payments/v2/#captures_get Endpoint: GET /v2/payments/captures/ID
func (*Client) CreateOrder ¶
func (c *Client) CreateOrder(ctx context.Context, intent string, purchaseUnits []PurchaseUnitRequest, paymentSource *PaymentSource, appContext *ApplicationContext) (*Order, error)
Create an order Endpoint: POST /v2/checkout/orders
func (*Client) CreateOrderWithPaypalRequestID ¶ added in v4.1.0
func (c *Client) CreateOrderWithPaypalRequestID(ctx context.Context, intent string, purchaseUnits []PurchaseUnitRequest, paymentSource *PaymentSource, appContext *ApplicationContext, requestID string, ) (*Order, error)
CreateOrderWithPaypalRequestID - Use this call to create an order with idempotency Endpoint: POST /v2/checkout/orders
func (*Client) CreatePayout ¶
CreatePayout 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) CreateProduct ¶
func (c *Client) CreateProduct(ctx context.Context, product Product) (*CreateProductResponse, error)
CreateProduct creates a product Doc: https://developer.paypal.com/docs/api/catalog-products/v1/#products_create Endpoint: POST /v1/catalogs/products
func (*Client) CreateSubscription ¶
func (c *Client) CreateSubscription(ctx context.Context, newSubscription SubscriptionBase) (*SubscriptionDetailResp, error)
CreateSubscriptionPlan creates a subscriptionPlan Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_create Endpoint: POST /v1/billing/subscriptions
func (*Client) CreateSubscriptionPlan ¶
func (c *Client) CreateSubscriptionPlan(ctx context.Context, newPlan SubscriptionPlan) (*CreateSubscriptionPlanResponse, error)
CreateSubscriptionPlan creates a subscriptionPlan Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#plans_create Endpoint: POST /v1/billing/plans
func (*Client) CreateWebProfile ¶
func (c *Client) CreateWebProfile(ctx context.Context, 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) CreateWebhook ¶
func (c *Client) CreateWebhook(ctx context.Context, createWebhookRequest *CreateWebhookRequest) (*Webhook, error)
CreateWebhook - Subscribes your webhook listener to events. Endpoint: POST /v1/notifications/webhooks
func (*Client) DeactivateSubscriptionPlans ¶
Deactivates a plan Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#plans_deactivate Endpoint: POST /v1/billing/plans/{id}/deactivate
func (*Client) DeleteCreditCard ¶
DeleteCreditCard func Endpoint: DELETE /v1/vault/credit-cards/credit_card_id
func (*Client) DeleteWebProfile ¶
DeleteWebProfile deletes a web experience profile from Paypal with given id
Endpoint: DELETE /v1/payment-experience/web-profiles
func (*Client) DeleteWebhook ¶
DeleteWebhook - Deletes a webhook, by ID. Endpoint: DELETE /v1/notifications/webhooks/ID
func (*Client) GenerateInvoiceNumber ¶ added in v4.7.0
func (c *Client) GenerateInvoiceNumber(ctx context.Context) (*InvoiceNumber, error)
GenerateInvoiceNumber: generates the next invoice number that is available to the merchant. Endpoint: POST /v2/invoicing/generate-next-invoice-number
func (*Client) GetAccessToken ¶
func (c *Client) GetAccessToken(ctx context.Context) (*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 ¶
GetAuthorization returns an authorization by ID Endpoint: GET /v2/payments/authorizations/ID
func (*Client) GetCreditCard ¶
GetCreditCard func Endpoint: GET /v1/vault/credit-cards/credit_card_id
func (*Client) GetCreditCards ¶
func (c *Client) GetCreditCards(ctx context.Context, ccf *CreditCardsFilter) (*CreditCards, error)
GetCreditCards func Endpoint: GET /v1/vault/credit-cards
func (*Client) GetInvoiceDetails ¶ added in v4.7.0
GetInvoiceDetails: show invoice details for a particular invoice by ID. Endpoint: GET /v2/invoicing/invoices/{invoice_id}
func (*Client) GetPayout ¶
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(ctx context.Context, 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) GetProduct ¶
Get product details Doc: https://developer.paypal.com/docs/api/catalog-products/v1/#products_get Endpoint: GET /v1/catalogs/products/:product_id
func (*Client) GetRefund ¶
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) GetSubscriptionDetails ¶
func (c *Client) GetSubscriptionDetails(ctx context.Context, subscriptionID string) (*SubscriptionDetailResp, error)
GetSubscriptionDetails shows details for a subscription, by ID. Endpoint: GET /v1/billing/subscriptions/
func (*Client) GetSubscriptionPlan ¶
UpdateSubscriptionPlan. updates a plan Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#plans_get Endpoint: GET /v1/billing/plans/:plan_id
func (*Client) GetSubscriptionTransactions ¶
func (c *Client) GetSubscriptionTransactions(ctx context.Context, requestParams SubscriptionTransactionsParams) (*SubscriptionTransactionsResponse, error)
Lists transactions for a subscription. Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_transactions Endpoint: GET /v1/billing/subscriptions/{id}/transactions
func (*Client) GetUserInfo ¶
GetUserInfo - Use this call to retrieve user profile attributes. Endpoint: GET /v1/identity/openidconnect/userinfo/?schema=<Schema>
func (*Client) GetWebProfile ¶
GetWebProfile gets an exists payment experience from Paypal
Endpoint: GET /v1/payment-experience/web-profiles/<profile-id>
func (*Client) GetWebProfiles ¶
func (c *Client) GetWebProfiles(ctx context.Context) ([]WebProfile, error)
GetWebProfiles retrieves web experience profiles from Paypal
Endpoint: GET /v1/payment-experience/web-profiles
func (*Client) GetWebhook ¶
GetWebhook - Shows details for a webhook, by ID. Endpoint: GET /v1/notifications/webhooks/ID
func (*Client) GetWebhookEventTypes ¶
func (c *Client) GetWebhookEventTypes(ctx context.Context) (*WebhookEventTypesResponse, error)
GetWebhookEventTypes - Lists all webhook event types. Endpoint: GET /v1/notifications/webhooks-event-types
func (*Client) ListProducts ¶
func (c *Client) ListProducts(ctx context.Context, params *ProductListParameters) (*ListProductsResponse, error)
List all products Doc: https://developer.paypal.com/docs/api/catalog-products/v1/#products_list Endpoint: GET /v1/catalogs/products
func (*Client) ListSubscriptionPlans ¶
func (c *Client) ListSubscriptionPlans(ctx context.Context, params *SubscriptionPlanListParameters) (*ListSubscriptionPlansResponse, error)
List all plans Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#plans_list Endpoint: GET /v1/billing/plans
func (*Client) ListTransactions ¶
func (c *Client) ListTransactions(ctx context.Context, req *TransactionSearchRequest) (*TransactionSearchResponse, error)
ListTransactions - Use this to search PayPal transactions from the last 31 days. Endpoint: GET /v1/reporting/transactions
func (*Client) ListWebhooks ¶
ListWebhooks - Lists webhooks for an app. Endpoint: GET /v1/notifications/webhooks
func (*Client) NewRequest ¶
func (c *Client) NewRequest(ctx context.Context, method, url string, payload interface{}) (*http.Request, error)
NewRequest constructs a request Convert payload to a JSON
func (*Client) PatchCreditCard ¶
func (c *Client) PatchCreditCard(ctx context.Context, id string, ccf []CreditCardField) (*CreditCard, error)
PatchCreditCard func Endpoint: PATCH /v1/vault/credit-cards/credit_card_id
func (*Client) ReauthorizeAuthorization ¶
func (c *Client) ReauthorizeAuthorization(ctx context.Context, authID string, a *Amount) (*Authorization, error)
ReauthorizeAuthorization reauthorize a Paypal account payment. PayPal recommends reauthorizing payment after ~3 days Endpoint: POST /v2/payments/authorizations/ID/reauthorize
func (*Client) RefundCapture ¶
func (c *Client) RefundCapture(ctx context.Context, captureID string, refundCaptureRequest RefundCaptureRequest) (*RefundResponse, error)
RefundCapture - https://developer.paypal.com/docs/api/payments/v2/#captures_refund Endpoint: POST /v2/payments/captures/ID/refund
func (*Client) RefundCaptureWithPaypalRequestId ¶
func (c *Client) RefundCaptureWithPaypalRequestId(ctx context.Context, captureID string, refundCaptureRequest RefundCaptureRequest, requestID string, ) (*RefundResponse, error)
RefundCapture with idempotency - https://developer.paypal.com/docs/api/payments/v2/#captures_refund Endpoint: POST /v2/payments/captures/ID/refund
func (*Client) ReviseSubscription ¶
func (c *Client) ReviseSubscription(ctx context.Context, subscriptionId string, reviseSubscription SubscriptionBase) (*SubscriptionDetailResp, error)
Revise plan or quantity of subscription Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_revise Endpoint: POST /v1/billing/subscriptions/{id}/revise
func (*Client) Send ¶
Send makes a request to the API, the response body will be unmarshalled into v, or if v is an io.Writer, the response will be written to it without decoding
func (*Client) SendWithAuth ¶
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 ¶
SendWithBasicAuth makes a request to the API using clientID:secret basic auth
func (*Client) SetAccessToken ¶
SetAccessToken sets saved token to current client
func (*Client) SetHTTPClient ¶
SetHTTPClient sets *http.Client to current client
func (*Client) SetLog ¶
SetLog will set/change the output destination. If log file is set paypal will log all requests and responses to this Writer
func (*Client) SetReturnRepresentation ¶
func (c *Client) SetReturnRepresentation()
SetReturnRepresentation enables verbose response Verbose response: https://developer.paypal.com/docs/api/orders/v2/#orders-authorize-header-parameters
func (*Client) SetWebProfile ¶
func (c *Client) SetWebProfile(ctx context.Context, 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(ctx context.Context, cc CreditCard) (*CreditCard, error)
StoreCreditCard func Endpoint: POST /v1/vault/credit-cards
func (*Client) SuspendSubscription ¶
Suspends the subscription. Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_suspend Endpoint: POST /v1/billing/subscriptions/{id}/suspend
func (*Client) UpdateOrder ¶
func (c *Client) UpdateOrder(ctx context.Context, orderID string, op string, path string, value map[string]string) error
UpdateOrder updates the order by ID Endpoint: PATCH /v2/checkout/orders/ID
func (*Client) UpdateProduct ¶
UpdateProduct. updates a product information Doc: https://developer.paypal.com/docs/api/catalog-products/v1/#products_patch Endpoint: PATCH /v1/catalogs/products/:product_id
func (*Client) UpdateSubscription ¶
func (c *Client) UpdateSubscription(ctx context.Context, updatedSubscription Subscription) error
UpdateSubscriptionPlan. updates a plan Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_patch Endpoint: PATCH /v1/billing/subscriptions/:subscription_id
func (*Client) UpdateSubscriptionPlan ¶
func (c *Client) UpdateSubscriptionPlan(ctx context.Context, updatedPlan SubscriptionPlan) error
UpdateSubscriptionPlan. updates a plan Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#plans_patch Endpoint: PATCH /v1/billing/plans/:plan_id
func (*Client) UpdateSubscriptionPlanPricing ¶
func (c *Client) UpdateSubscriptionPlanPricing(ctx context.Context, planId string, pricingSchemes []PricingSchemeUpdate) error
Updates pricing for a plan. For example, you can update a regular billing cycle from $5 per month to $7 per month. Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#plans_update-pricing-schemes Endpoint: POST /v1/billing/plans/{id}/update-pricing-schemes
func (*Client) UpdateWebhook ¶
func (c *Client) UpdateWebhook(ctx context.Context, webhookID string, fields []WebhookField) (*Webhook, error)
UpdateWebhook - Updates a webhook to replace webhook fields with new values. Endpoint: PATCH /v1/notifications/webhooks/ID
func (*Client) VerifyWebhookSignature ¶
func (c *Client) VerifyWebhookSignature(ctx context.Context, httpReq *http.Request, webhookID string) (*VerifyWebhookResponse, error)
VerifyWebhookSignature - Use this to verify the signature of a webhook recieved from paypal. Endpoint: POST /v1/notifications/verify-webhook-signature
func (*Client) VoidAuthorization ¶
VoidAuthorization voids a previously authorized payment Endpoint: POST /v2/payments/authorizations/ID/void
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 CreateProductResponse ¶
type CreateProductResponse struct { Product }
type CreateSubscriptionPlanResponse ¶
type CreateSubscriptionPlanResponse struct { SubscriptionPlan }
type CreateWebhookRequest ¶
type CreateWebhookRequest struct { URL string `json:"url"` EventTypes []WebhookEventType `json:"event_types"` }
CreateWebhookRequest struct
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"` }
CreditCards GET /v1/vault/credit-cards
type CreditCardsFilter ¶
CreditCardsFilter struct
type Currency ¶
type Currency struct { Currency string `json:"currency,omitempty"` Value string `json:"value,omitempty"` }
Currency struct
type CustomAmount ¶ added in v4.7.0
used in InvoiceAmountWithBreakdown Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-custom_amount
type CycleExecutions ¶
type CycleExecutions struct { TenureType string `json:"tenure_type,omitempty"` Sequence int `json:"sequence,omitempty"` CyclesCompleted int `json:"cycles_completed,omitempty"` CyclesRemaining int `json:"cycles_remaining,omitempty"` TotalCycles int `json:"total_cycles,omitempty"` }
CycleExecutions 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"` Name string `json:"name"` Message string `json:"message"` Description string `json:"description"` Links []Link `json:"link"` }
ErrorResponseDetail struct
type Event ¶ added in v4.1.0
type Event struct { ID string `json:"id"` CreateTime time.Time `json:"create_time"` ResourceType string `json:"resource_type"` EventType string `json:"event_type"` Summary string `json:"summary,omitempty"` Links []Link `json:"links"` EventVersion string `json:"event_version,omitempty"` ResourceVersion string `json:"resource_version,omitempty"` }
Event struct.
The basic webhook event data type. This struct is intended to be embedded into resource type specific event structs.
type ExchangeRate ¶
type ExchangeRate struct { SourceCurrency string `json:"source_currency"` TargetCurrency string `json:"target_currency"` Value string `json:"value"` }
ExchangeRate struct
https://developer.paypal.com/docs/api/orders/v2/#definition-exchange_rate
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 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 Frequency ¶
type Frequency struct { IntervalUnit IntervalUnit `json:"interval_unit"` IntervalCount int `json:"interval_count"` //different per unit. check documentation }
doc: https://developer.paypal.com/docs/api/subscriptions/v1/#definition-frequency
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 IntegrationDetails ¶
type IntegrationDetails struct {
RestAPIIntegration *RestAPIIntegration `json:"rest_api_integration,omitempty"`
}
type IntervalUnit ¶
type IntervalUnit string
const ( IntervalUnitDay IntervalUnit = "DAY" IntervalUnitWeek IntervalUnit = "WEEK" IntervalUnitMonth IntervalUnit = "MONTH" IntervalUnitYear IntervalUnit = "YEAR" )
type Invoice ¶ added in v4.7.0
type Invoice struct { AdditionalRecipients []InvoiceEmailAddress `json:"additional_recipients,omitempty"` // An array of one or more CC: emails to which notifications are sent. AmountSummary AmountSummaryDetail `json:"amount,omitempty"` Configuration InvoiceConfiguration `json:"configuration,omitempty"` Detail InvoiceDetail `json:"detail,omitempty"` DueAmount Money `json:"due_amount,omitempty"` // balance amount outstanding after payments. Gratuity Money `json:"gratuity,omitempty"` // amount paid by the payer as gratuity to the invoicer. ID string `json:"id,omitempty"` Invoicer InvoicerInfo `json:"invoicer,omitempty"` Items []InvoiceItem `json:"items,omitempty"` Links []Link `json:"links,omitempty"` ParentID string `json:"parent_id,omitempty"` Payments InvoicePayments `json:"payments,omitempty"` PrimaryRecipients []InvoiceRecipientInfo `json:"primary_recipients,omitempty"` Refunds InvoiceRefund `json:"refunds,omitempty"` // List of refunds against this invoice. Status string `json:"status,omitempty"` }
to contain Invoice related fields Doc: https://developer.paypal.com/docs/api/invoicing/v2/#invoices_get
type InvoiceAddressDetails ¶ added in v4.7.0
type InvoiceAddressDetails struct { BuildingName string `json:"building_name,omitempty"` DeliveryService string `json:"delivery_service,omitempty"` StreetName string `json:"street_name,omitempty"` StreetNumber string `json:"street_number,omitempty"` StreetType string `json:"street_type,omitempty"` SubBuilding string `json:"sub_building,omitempty"` }
used in InvoiceAddressPortable Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-address_details
type InvoiceAddressPortable ¶ added in v4.7.0
type InvoiceAddressPortable struct { CountryCode string `json:"country_code"` AddressDetails InvoiceAddressDetails `json:"address_details,omitempty"` AddressLine1 string `json:"address_line_1,omitempty"` AddressLine2 string `json:"address_line_2,omitempty"` AddressLine3 string `json:"address_line_3,omitempty"` AdminArea1 string `json:"admin_area_1,omitempty"` AdminArea2 string `json:"admin_area_2,omitempty"` AdminArea3 string `json:"admin_area_3,omitempty"` AdminArea4 string `json:"admin_area_4,omitempty"` PostalCode string `json:"postal_code,omitempty"` }
used in InvoiceContactInfo Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-address_portable
type InvoiceAmountWithBreakdown ¶ added in v4.7.0
type InvoiceAmountWithBreakdown struct { Custom CustomAmount `json:"custom,omitempty"` // The custom amount to apply to an invoice. Discount AggregatedDiscount `json:"discount,omitempty"` ItemTotal Money `json:"item_total,omitempty"` // The subtotal for all items. Shipping InvoiceShippingCost `json:"shipping,omitempty"` // The shipping fee for all items. Includes tax on shipping. TaxTotal Money `json:"tax_total,omitempty"` }
Used in AmountSummaryDetail Doc: https://developer.paypal.com/docs/api/payments/v2/#definition-nrp-nrr_attributes
type InvoiceAuditMetadata ¶ added in v4.7.0
type InvoiceAuditMetadata struct { CreateTime string `json:"create_time,omitempty"` CreatedBy string `json:"created_by,omitempty"` LastUpdateTime string `json:"last_update_time,omitempty"` LastUpdatedBy string `json:"last_updated_by,omitempty"` CancelTime string `json:"cancel_time,omitempty"` CancellledTimeBy string `json:"cancelled_by,omitempty"` CreatedByFlow string `json:"created_by_flow,omitempty"` FirstSentTime string `json:"first_sent_time,omitempty"` InvoicerViewUrl string `json:"invoicer_view_url,omitempty"` LastSentBy string `json:"last_sent_by,omitempty"` LastSentTime string `json:"last_sent_time,omitempty"` RecipientViewUrl string `json:"recipient_view_url,omitempty"` }
Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-metadata
type InvoiceBillingInfo ¶ added in v4.7.0
type InvoiceBillingInfo struct { AdditionalInfo string `json:"additional_info,omitempty"` EmailAddress string `json:"email_address,omitempty"` Language string `json:"language,omitempty"` Phones []InvoicerPhoneDetail `json:"phones,omitempty"` // invoice recipient's phone numbers. }
used in InvoiceRecipientInfo Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-billing_info
type InvoiceConfiguration ¶ added in v4.7.0
type InvoiceConfiguration struct { AllowTip bool `json:"allow_tip,omitempty"` PartialPayment InvoicePartialPayment `json:"partial_payment,omitempty"` TaxCalculatedAfterDiscount bool `json:"tax_calculated_after_discount,omitempty"` TaxInclusive bool `json:"tax_inclusive,omitempty"` TemplateId string `json:"template_id,omitempty"` }
Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-configuration
type InvoiceContactInfo ¶ added in v4.7.0
type InvoiceContactInfo struct { BusinessName string `json:"business_name,omitempty"` RecipientAddress InvoiceAddressPortable `json:"address,omitempty"` // address of the recipient. RecipientName Name `json:"name,omitempty"` // The first and Last name of the recipient. }
used in InvoicePaymentDetails Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-contact_information
type InvoiceDetail ¶ added in v4.7.0
type InvoiceDetail struct { CurrencyCode string `json:"currency_code"` // required, hence omitempty not used Attachments []InvoiceFileReference `json:"attachments,omitempty"` Memo string `json:"memo,omitempty"` Note string `json:"note,omitempty"` Reference string `json:"reference,omitempty"` TermsAndConditions string `json:"terms_and_conditions,omitempty"` InvoiceDate string `json:"invoice_date,omitempty"` InvoiceNumber string `json:"invoice_number,omitempty"` Metadata InvoiceAuditMetadata `json:"metadata,omitempty"` // The audit metadata. PaymentTerm InvoicePaymentTerm `json:"payment_term,omitempty"` // payment due date for the invoice. Value is either but not both term_type or due_date. }
used in Invoice struct Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-invoice_detail
type InvoiceEmailAddress ¶ added in v4.7.0
type InvoiceEmailAddress struct {
EmailAddress string `json:"email_address,omitempty"`
}
used in Invoice struct Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-email_address
type InvoiceFileReference ¶ added in v4.7.0
type InvoiceFileReference struct { ContentType string `json:"content_type,omitempty"` CreateTime string `json:"create_time,omitempty"` ID string `json:"id,omitempty"` URL string `json:"reference_url,omitempty"` Size string `json:"size,omitempty"` }
used in InvoiceDetail structure Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-file_reference
type InvoiceItem ¶ added in v4.7.0
type InvoiceItem struct { Name string `json:"name"` Quantity string `json:"quantity"` UnitAmount Money `json:"unit_amount"` Description string `json:"description,omitempty"` InvoiceDiscount InvoicingDiscount `json:"discount,omitempty"` ID string `json:"id,omitempty"` ItemDate string `json:"item_date,omitempty"` Tax InvoiceTax `json:"tax,omitempty"` UnitOfMeasure string `json:"unit_of_measure,omitempty"` }
Used in Invoice struct Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-item
type InvoiceNumber ¶ added in v4.7.0
type InvoiceNumber struct {
InvoiceNumberValue string `json:"invoice_number"`
}
Invoicing relates structures Doc: https://developer.paypal.com/docs/api/invoicing/v2/#invoices_generate-next-invoice-number
type InvoicePartialPayment ¶ added in v4.7.0
type InvoicePartialPayment struct { AllowPartialPayment bool `json:"allow_partial_payment,omitempty"` MinimumAmountDue Money `json:"minimum_amount_due,omitempty"` // Valid only when allow_partial_payment is true. }
Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-partial_payment
type InvoicePaymentDetails ¶ added in v4.7.0
type InvoicePaymentDetails struct { Method string `json:"method"` Amount Money `json:"amount,omitempty"` Note string `json:"note,omitempty"` PaymentDate string `json:"payment_date,omitempty"` PaymentID string `json:"payment_id,omitempty"` ShippingInfo InvoiceContactInfo `json:"shipping_info,omitempty"` // The recipient's shipping information. Type string `json:"type,omitempty"` }
used in InvoicePayments struct Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-payment_detail
type InvoicePaymentTerm ¶ added in v4.7.0
type InvoicePaymentTerm struct { TermType string `json:"term_type,omitempty"` DueDate string `json:"due_date,omitempty"` }
used in InvoiceDetail struct Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-invoice_payment_term
type InvoicePayments ¶ added in v4.7.0
type InvoicePayments struct { PaidAmount Money `json:"paid_amount,omitempty"` Transactions []InvoicePaymentDetails `json:"transactions,omitempty"` }
used in Invoice Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-payments
type InvoiceRecipientInfo ¶ added in v4.7.0
type InvoiceRecipientInfo struct { BillingInfo InvoiceBillingInfo `json:"billing_info,omitempty"` // billing information for the invoice recipient. ShippingInfo InvoiceContactInfo `json:"shipping_info,omitempty"` // recipient's shipping information. }
used in Invoice struct Doc:
type InvoiceRefund ¶ added in v4.7.0
type InvoiceRefund struct { RefundAmount Money `json:"refund_amount,omitempty"` RefundDetails []InvoiceRefundDetails `json:"transactions,omitempty"` }
used in Invoice struct Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-refunds
type InvoiceRefundDetails ¶ added in v4.7.0
type InvoiceRefundDetails struct { Method string `json:"method"` RefundAmount Money `json:"amount,omitempty"` RefundDate string `json:"refund_date,omitempty"` RefundID string `json:"refund_id,omitempty"` RefundType string `json:"type,omitempty"` }
used in InvoiceRefund struct Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-refund_detail
type InvoiceShippingCost ¶ added in v4.7.0
type InvoiceShippingCost struct { Amount Money `json:"amount,omitempty"` Tax InvoiceTax `json:"tax,omitempty"` }
Used in InvoiceAmountWithBreakdown struct Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-shipping_cost
type InvoiceTax ¶ added in v4.7.0
type InvoiceTax struct { Name string `json:"name,omitempty"` Percent string `json:"percent,omitempty"` ID string `json:"id,omitempty"` // not mentioned here, but is still returned in response payload, when invoice is requested by ID. Amount Money `json:"amount,omitempty"` }
Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-tax
type InvoicerInfo ¶ added in v4.7.0
type InvoicerInfo struct { AdditionalNotes string `json:"additional_notes,omitempty"` EmailAddress string `json:"email_address,omitempty"` LogoUrl string `json:"logo_url,omitempty"` Phones []InvoicerPhoneDetail `json:"phones,omitempty"` TaxId string `json:"tax_id,omitempty"` Website string `json:"website,omitempty"` }
used in Invoice struct Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-invoicer_info
type InvoicerPhoneDetail ¶ added in v4.7.0
type InvoicerPhoneDetail struct { CountryCode string `json:"country_code"` NationalNumber string `json:"national_number"` ExtensionNumber string `json:"extension_number,omitempty"` PhoneType string `json:"phone_type,omitempty"` }
used in InvoicerInfo struct Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-phone_detail
type InvoicingDiscount ¶ added in v4.7.0
type InvoicingDiscount struct { DiscountAmount Money `json:"amount,omitempty"` Percent string `json:"percent,omitempty"` }
Used in AggregatedDiscount Doc: https://developer.paypal.com/docs/api/invoicing/v2/#definition-discount
type Item ¶
type Item struct { Name string `json:"name"` UnitAmount *Money `json:"unit_amount,omitempty"` Tax *Money `json:"tax,omitempty"` Quantity string `json:"quantity"` Description string `json:"description,omitempty"` SKU string `json:"sku,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 ¶
JSONTime overrides MarshalJson method to format in ISO8601
func (JSONTime) MarshalJSON ¶
MarshalJSON for JSONTime
func (*JSONTime) UnmarshalJSON ¶
UnmarshalJSON for JSONTime, timezone offset is missing a colon ':"
type LastPayment ¶
type LastPayment struct { Amount Money `json:"amount,omitempty"` Time time.Time `json:"time,omitempty"` }
LastPayment struct
type Link ¶
type Link struct { Href string `json:"href"` Rel string `json:"rel,omitempty"` Method string `json:"method,omitempty"` Description string `json:"description,omitempty"` Enctype string `json:"enctype,omitempty"` }
Link struct
type ListParams ¶
type ListProductsResponse ¶
type ListProductsResponse struct { Products []Product `json:"products"` }
type ListSubscriptionPlansResponse ¶
type ListSubscriptionPlansResponse struct { Plans []SubscriptionPlan `json:"plans"` }
type ListWebhookResponse ¶
type ListWebhookResponse struct {
Webhooks []Webhook `json:"webhooks"`
}
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 Name ¶
type Name struct { FullName string `json:"full_name,omitempty"` Suffix string `json:"suffix,omitempty"` Prefix string `json:"prefix,omitempty"` GivenName string `json:"given_name,omitempty"` Surname string `json:"surname,omitempty"` MiddleName string `json:"middle_name,omitempty"` }
Name struct Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#definition-name
type Operation ¶
type Operation struct { Operation string `json:"operation"` APIIntegrationPreference *IntegrationDetails `json:"api_integration_preference,omitempty"` }
type Order ¶
type Order struct { ID string `json:"id,omitempty"` Status string `json:"status,omitempty"` Intent string `json:"intent,omitempty"` Payer *PayerWithNameAndPhone `json:"payer,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 PartnerConfigOverride ¶
type PartnerConfigOverride struct { PartnerLogoURL string `json:"partner_logo_url,omitempty"` ReturnURL string `json:"return_url,omitempty"` ReturnURLDescription string `json:"return_url_description,omitempty"` ActionRenewalURL string `json:"action_renewal_url,omitempty"` ShowAddCreditCard *bool `json:"show_add_credit_card,omitempty"` }
type PayeeForOrders ¶
type PayeeForOrders struct { EmailAddress string `json:"email_address,omitempty"` MerchantID string `json:"merchant_id,omitempty"` }
PayeeForOrders struct
type PayeePreferred ¶ added in v4.5.1
type PayeePreferred string // Doc: https://developer.paypal.com/api/orders/v2/#definition-payment_method
const ( PayeePreferredUnrestricted PayeePreferred = "UNRESTRICTED" PayeePreferredImmediatePaymentRequired PayeePreferred = "IMMEDIATE_PAYMENT_REQUIRED" )
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"` BirthDate string `json:"birth_date,omitempty"` TaxInfo *TaxInfo `json:"tax_info,omitempty"` Address *ShippingDetailAddressPortable `json:"address,omitempty"` }
PayerWithNameAndPhone struct
type PaymentCaptureRequest ¶
type PaymentCaptureRequest struct { InvoiceID string `json:"invoice_id,omitempty"` NoteToPayer string `json:"note_to_payer,omitempty"` SoftDescriptor string `json:"soft_descriptor,omitempty"` Amount *Money `json:"amount,omitempty"` FinalCapture bool `json:"final_capture,omitempty"` }
https://developer.paypal.com/docs/api/payments/v2/#authorizations_capture
type PaymentCaptureResponse ¶
type PaymentCaptureResponse struct { Status string `json:"status,omitempty"` StatusDetails *CaptureStatusDetails `json:"status_details,omitempty"` ID string `json:"id,omitempty"` Amount *Money `json:"amount,omitempty"` InvoiceID string `json:"invoice_id,omitempty"` FinalCapture bool `json:"final_capture,omitempty"` DisbursementMode string `json:"disbursement_mode,omitempty"` Links []Link `json:"links,omitempty"` }
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 PaymentInstruction ¶
type PaymentInstruction struct { PlatformFees []PlatformFee `json:"platform_fees,omitempty"` DisbursementMode string `json:"disbursement_mode,omitempty"` }
https://developer.paypal.com/docs/api/payments/v2/#definition-payment_instruction
type PaymentMethod ¶ added in v4.5.1
type PaymentMethod struct { PayeePreferred PayeePreferred `json:"payee_preferred,omitempty"` StandardEntryClassCode StandardEntryClassCode `json:"standard_entry_class_code,omitempty"` }
Doc: https://developer.paypal.com/api/orders/v2/#definition-payment_method
type PaymentOptions ¶
type PaymentOptions struct {
AllowedPaymentMethod string `json:"allowed_payment_method,omitempty"`
}
PaymentOptions struct
type PaymentPatch ¶
type PaymentPatch struct { Operation string `json:"op"` Path string `json:"path"` Value interface{} `json:"value"` }
PaymentPatch PATCH /v2/payments/payment/{payment_id)
type PaymentPayer ¶
type PaymentPayer struct { PaymentMethod string `json:"payment_method"` Status string `json:"status,omitempty"` PayerInfo *PayerInfo `json:"payer_info,omitempty"` }
PaymentPayer struct
type PaymentPreferences ¶
type PaymentPreferences struct { AutoBillOutstanding bool `json:"auto_bill_outstanding"` SetupFee *Money `json:"setup_fee"` SetupFeeFailureAction SetupFeeFailureAction `json:"setup_fee_failure_action"` PaymentFailureThreshold int `json:"payment_failure_threshold"` }
Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#definition-payment_preferences
type PaymentPreferencesOverride ¶ added in v4.5.0
type PaymentPreferencesOverride struct { AutoBillOutstanding bool `json:"auto_bill_outstanding,omitempty"` SetupFee Money `json:"setup_fee,omitempty"` SetupFeeFailureAction SetupFeeFailureAction `json:"setup_fee_failure_action,omitempty"` PaymentFailureThreshold int `json:"payment_failure_threshold,omitempty"` }
https://developer.paypal.com/docs/api/subscriptions/v1/#definition-payment_preferences_override
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,omitempty"` Token *PaymentSourceToken `json:"token,omitempty"` Paypal *PaymentSourcePaypal `json:"paypal,omitempty"` }
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 PaymentSourcePaypal ¶ added in v4.9.0
type PaymentSourcePaypal struct {
ExperienceContext PaymentSourcePaypalExperienceContext `json:"experience_context"`
}
PaymentSourcePaypal structure
type PaymentSourcePaypalExperienceContext ¶ added in v4.9.0
type PaymentSourcePaypalExperienceContext struct { PaymentMethodPreference string `json:"payment_method_preference"` BrandName string `json:"brand_name"` Locale string `json:"locale"` LandingPage string `json:"landing_page"` ShippingPreference string `json:"shipping_preference"` UserAction string `json:"user_action"` ReturnURL string `json:"return_url"` CancelURL string `json:"cancel_url"` }
type PaymentSourceToken ¶
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"` RecipientWallet string `json:"recipient_wallet"` 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 Plan ¶ added in v4.2.0
type Plan struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` CreateTime string `json:"create_time,omitempty"` UpdateTime string `json:"update_time,omitempty"` PaymentDefinitions []PaymentDefinition `json:"payment_definitions,omitempty"` }
Plan struct
type PlanOverride ¶ added in v4.5.0
type PlanOverride struct { BillingCycles []BillingCycleOverride `json:"billing_cycles,omitempty"` PaymentPreferences *PaymentPreferencesOverride `json:"payment_preferences,omitempty"` Taxes *TaxesOverride `json:"taxes,omitempty"` }
https://developer.paypal.com/docs/api/subscriptions/v1/#definition-plan_override
type PlatformFee ¶
type PlatformFee struct { Amount *Money `json:"amount,omitempty"` Payee *PayeeForOrders `json:"payee,omitempty"` }
https://developer.paypal.com/docs/api/payments/v2/#definition-platform_fee
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 PricingScheme ¶
type PricingSchemeUpdate ¶
type PricingSchemeUpdate struct { BillingCycleSequence int `json:"billing_cycle_sequence"` PricingScheme PricingScheme `json:"pricing_scheme"` }
type PricingSchemeUpdateRequest ¶
type PricingSchemeUpdateRequest struct {
Schemes []PricingSchemeUpdate `json:"pricing_schemes"`
}
type Product ¶
type Product struct { ID string `json:"id,omitempty"` Name string `json:"name"` Description string `json:"description,omitempty"` Category ProductCategory `json:"category,omitempty"` Type ProductType `json:"type"` ImageUrl string `json:"image_url,omitempty"` HomeUrl string `json:"home_url,omitempty"` }
Product struct
func (*Product) GetUpdatePatch ¶
type ProductCategory ¶
type ProductCategory string //Doc: https://developer.paypal.com/docs/api/catalog-products/v1/#definition-product_category
type ProductListParameters ¶
type ProductListParameters struct {
ListParams
}
type ProductType ¶
type ProductType string
type PurchaseUnit ¶
type PurchaseUnit struct { ReferenceID string `json:"reference_id"` Amount *PurchaseUnitAmount `json:"amount,omitempty"` Payee *PayeeForOrders `json:"payee,omitempty"` Payments *CapturedPayments `json:"payments,omitempty"` PaymentInstruction *PaymentInstruction `json:"payment_instruction,omitempty"` Description string `json:"description,omitempty"` CustomID string `json:"custom_id,omitempty"` InvoiceID string `json:"invoice_id,omitempty"` ID string `json:"id,omitempty"` SoftDescriptor string `json:"soft_descriptor,omitempty"` Shipping *ShippingDetail `json:"shipping,omitempty"` Items []Item `json:"items,omitempty"` }
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"` PaymentInstruction *PaymentInstruction `json:"payment_instruction,omitempty"` }
PurchaseUnitRequest struct
type RedirectURLs ¶
type RedirectURLs struct { ReturnURL string `json:"return_url,omitempty"` CancelURL string `json:"cancel_url,omitempty"` }
RedirectURLs struct
type ReferralRequest ¶
type ReferralRequest struct { TrackingID string `json:"tracking_id"` PartnerConfigOverride *PartnerConfigOverride `json:"partner_config_override,omitempty"` Operations []Operation `json:"operations,omitempty"` Products []string `json:"products,omitempty"` LegalConsents []Consent `json:"legal_consents,omitempty"` }
type ReferralResponse ¶ added in v4.3.6
type ReferralResponse struct {
Links []Link `json:"links,omitempty"`
}
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"` SaleID string `json:"sale_id,omitempty"` }
Refund struct
type RefundCaptureRequest ¶
type RefundCaptureRequest struct { Amount *Money `json:"amount,omitempty"` InvoiceID string `json:"invoice_id,omitempty"` NoteToPayer string `json:"note_to_payer,omitempty"` }
RefundOrderRequest - https://developer.paypal.com/docs/api/payments/v2/#captures_refund
type RefundResponse ¶
type RefundResponse struct { ID string `json:"id,omitempty"` Amount *PurchaseUnitAmount `json:"amount,omitempty"` Status string `json:"status,omitempty"` Links []Link `json:"links,omitempty"` }
RefundResponse .
type Related ¶
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 RestAPIIntegration ¶
type RestAPIIntegration struct { IntegrationMethod string `json:"integration_method"` IntegrationType string `json:"integration_type"` ThirdPartyDetails ThirdPartyDetails `json:"third_party_details"` }
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 SearchCartInfo ¶
type SearchCartInfo struct { ItemDetails []SearchItemDetails `json:"item_details"` TaxInclusive *bool `json:"tax_inclusive"` PayPalInvoiceID string `json:"paypal_invoice_id"` }
type SearchCheckoutOption ¶
type SearchItemDetails ¶
type SearchItemDetails struct { ItemCode string `json:"item_code"` ItemName string `json:"item_name"` ItemDescription string `json:"item_description"` ItemOptions string `json:"item_options"` ItemQuantity string `json:"item_quantity"` ItemUnitPrice Money `json:"item_unit_price"` ItemAmount Money `json:"item_amount"` DiscountAmount *Money `json:"discount_amount"` AdjustmentAmount *Money `json:"adjustment_amount"` GiftWrapAmount *Money `json:"gift_wrap_amount"` TaxPercentage string `json:"tax_percentage"` TaxAmounts []SearchTaxAmount `json:"tax_amounts"` BasicShippingAmount *Money `json:"basic_shipping_amount"` ExtraShippingAmount *Money `json:"extra_shipping_amount"` HandlingAmount *Money `json:"handling_amount"` InsuranceAmount *Money `json:"insurance_amount"` TotalItemAmount Money `json:"total_item_amount"` InvoiceNumber string `json:"invoice_number"` CheckoutOptions []SearchCheckoutOption `json:"checkout_options"` }
type SearchPayerInfo ¶
type SearchPayerInfo struct { AccountID string `json:"account_id"` EmailAddress string `json:"email_address"` PhoneNumber *PhoneWithTypeNumber `json:"phone_number"` AddressStatus string `json:"address_status"` PayerStatus string `json:"payer_status"` PayerName SearchPayerName `json:"payer_name"` CountryCode string `json:"country_code"` Address *Address `json:"address"` }
type SearchPayerName ¶
type SearchShippingInfo ¶
type SearchTaxAmount ¶
type SearchTaxAmount struct {
TaxAmount Money `json:"tax_amount"`
}
type SearchTransactionDetails ¶
type SearchTransactionDetails struct { TransactionInfo SearchTransactionInfo `json:"transaction_info"` PayerInfo *SearchPayerInfo `json:"payer_info"` ShippingInfo *SearchShippingInfo `json:"shipping_info"` CartInfo *SearchCartInfo `json:"cart_info"` }
type SearchTransactionInfo ¶
type SearchTransactionInfo struct { PayPalAccountID string `json:"paypal_account_id"` TransactionID string `json:"transaction_id"` PayPalReferenceID string `json:"paypal_reference_id"` PayPalReferenceIDType string `json:"paypal_reference_id_type"` TransactionEventCode string `json:"transaction_event_code"` TransactionInitiationDate JSONTime `json:"transaction_initiation_date"` TransactionUpdatedDate JSONTime `json:"transaction_updated_date"` TransactionAmount Money `json:"transaction_amount"` FeeAmount *Money `json:"fee_amount"` InsuranceAmount *Money `json:"insurance_amount"` ShippingAmount *Money `json:"shipping_amount"` ShippingDiscountAmount *Money `json:"shipping_discount_amount"` ShippingTaxAmount *Money `json:"shipping_tax_amount"` OtherAmount *Money `json:"other_amount"` TipAmount *Money `json:"tip_amount"` TransactionStatus string `json:"transaction_status"` TransactionSubject string `json:"transaction_subject"` PaymentTrackingID string `json:"payment_tracking_id"` BankReferenceID string `json:"bank_reference_id"` TransactionNote string `json:"transaction_note"` EndingBalance *Money `json:"ending_balance"` AvailableBalance *Money `json:"available_balance"` InvoiceID string `json:"invoice_id"` CustomField string `json:"custom_field"` ProtectionEligibility string `json:"protection_eligibility"` CreditTerm string `json:"credit_term"` CreditTransactionalFee *Money `json:"credit_transactional_fee"` CreditPromotionalFee *Money `json:"credit_promotional_fee"` AnnualPercentageRate string `json:"annual_percentage_rate"` PaymentMethodType string `json:"payment_method_type"` }
type SellerProtection ¶
type SellerReceivableBreakdown ¶
type SellerReceivableBreakdown struct { GrossAmount *Money `json:"gross_amount,omitempty"` PaypalFee *Money `json:"paypal_fee,omitempty"` PaypalFeeInReceivableCurrency *Money `json:"paypal_fee_in_receivable_currency,omitempty"` NetAmount *Money `json:"net_amount,omitempty"` ReceivableAmount *Money `json:"receivable_amount,omitempty"` ExchangeRate *ExchangeRate `json:"exchange_rate,omitempty"` PlatformFees []PlatformFee `json:"platform_fees,omitempty"` }
SellerReceivableBreakdown has the detailed breakdown of the capture activity.
type SenderBatchHeader ¶
type SenderBatchHeader struct { EmailSubject string `json:"email_subject"` EmailMessage string `json:"email_message"` SenderBatchID string `json:"sender_batch_id,omitempty"` }
SenderBatchHeader struct
type SetupFeeFailureAction ¶
type SetupFeeFailureAction string
const ( SetupFeeFailureActionContinue SetupFeeFailureAction = "CONTINUE" SetupFeeFailureActionCancel SetupFeeFailureAction = "CANCEL" )
type SharedListResponse ¶
type SharedListResponse struct {}
type SharedResponse ¶
type SharedResponse 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 ShippingPreference ¶
type ShippingPreference string
const ( ShippingPreferenceGetFromFile ShippingPreference = "GET_FROM_FILE" ShippingPreferenceNoShipping ShippingPreference = "NO_SHIPPING" ShippingPreferenceSetProvidedAddress ShippingPreference = "SET_PROVIDED_ADDRESS" )
type StandardEntryClassCode ¶ added in v4.5.1
type StandardEntryClassCode string // Doc: https://developer.paypal.com/api/orders/v2/#definition-payment_method
const ( StandardEntryClassCodeTel StandardEntryClassCode = "TEL" StandardEntryClassCodeWeb StandardEntryClassCode = "WEB" StandardEntryClassCodeCcd StandardEntryClassCode = "CCD" StandardEntryClassCodePpd StandardEntryClassCode = "PPD" )
type Subscriber ¶
type Subscriber struct { PayerID string `json:"payer_id"` ShippingAddress ShippingDetail `json:"shipping_address,omitempty"` Name CreateOrderPayerName `json:"name,omitempty"` EmailAddress string `json:"email_address,omitempty"` }
Subscriber struct
type Subscription ¶
type Subscription struct {
SubscriptionDetailResp
}
func (*Subscription) GetUpdatePatch ¶
func (p *Subscription) GetUpdatePatch() []Patch
type SubscriptionBase ¶
type SubscriptionBase struct { PlanID string `json:"plan_id"` StartTime *JSONTime `json:"start_time,omitempty"` Quantity string `json:"quantity,omitempty"` ShippingAmount *Money `json:"shipping_amount,omitempty"` Subscriber *Subscriber `json:"subscriber,omitempty"` AutoRenewal bool `json:"auto_renewal,omitempty"` ApplicationContext *ApplicationContext `json:"application_context,omitempty"` CustomID string `json:"custom_id,omitempty"` Plan *PlanOverride `json:"plan,omitempty"` }
type SubscriptionCaptureResponse ¶
type SubscriptionCaptureResponse struct { Status SubscriptionTransactionStatus `json:"status"` Id string `json:"id"` AmountWithBreakdown AmountWithBreakdown `json:"amount_with_breakdown"` PayerName Name `json:"payer_name"` PayerEmail string `json:"payer_email"` Time time.Time `json:"time"` }
type SubscriptionDetailResp ¶
type SubscriptionDetailResp struct { SubscriptionBase SubscriptionDetails BillingInfo BillingInfo `json:"billing_info,omitempty"` // not found in documentation }
SubscriptionDetailResp struct
type SubscriptionDetails ¶
type SubscriptionDetails struct { ID string `json:"id,omitempty"` SubscriptionStatus SubscriptionStatus `json:"status,omitempty"` SubscriptionStatusChangeNote string `json:"status_change_note,omitempty"` StatusUpdateTime time.Time `json:"status_update_time,omitempty"` }
type SubscriptionPlan ¶
type SubscriptionPlan struct { ID string `json:"id,omitempty"` ProductId string `json:"product_id"` Name string `json:"name"` Status SubscriptionPlanStatus `json:"status"` Description string `json:"description,omitempty"` BillingCycles []BillingCycle `json:"billing_cycles"` PaymentPreferences *PaymentPreferences `json:"payment_preferences"` Taxes *Taxes `json:"taxes"` QuantitySupported bool `json:"quantity_supported"` //Indicates whether you can subscribe to this plan by providing a quantity for the goods or service. }
SubscriptionDetailResp struct
func (*SubscriptionPlan) GetUpdatePatch ¶
func (p *SubscriptionPlan) GetUpdatePatch() []Patch
type SubscriptionPlanListParameters ¶
type SubscriptionPlanListParameters struct { ProductId string `json:"product_id"` PlanIds string `json:"plan_ids"` // Filters the response by list of plan IDs. Filter supports upto 10 plan IDs. ListParams }
type SubscriptionPlanStatus ¶
type SubscriptionPlanStatus string
const ( SubscriptionPlanStatusCreated SubscriptionPlanStatus = "CREATED" SubscriptionPlanStatusInactive SubscriptionPlanStatus = "INACTIVE" SubscriptionPlanStatusActive SubscriptionPlanStatus = "ACTIVE" )
type SubscriptionStatus ¶
type SubscriptionStatus string
const ( SubscriptionStatusApprovalPending SubscriptionStatus = "APPROVAL_PENDING" SubscriptionStatusApproved SubscriptionStatus = "APPROVED" SubscriptionStatusActive SubscriptionStatus = "ACTIVE" SubscriptionStatusSuspended SubscriptionStatus = "SUSPENDED" SubscriptionStatusCancelled SubscriptionStatus = "CANCELLED" SubscriptionStatusExpired SubscriptionStatus = "EXPIRED" )
type SubscriptionTransactionStatus ¶
type SubscriptionTransactionStatus string
Doc: https://developer.paypal.com/docs/api/subscriptions/v1/#definition-transaction
const ( SubscriptionCaptureStatusCompleted SubscriptionTransactionStatus = "COMPLETED" SubscriptionCaptureStatusDeclined SubscriptionTransactionStatus = "DECLINED" SubscriptionCaptureStatusPartiallyRefunded SubscriptionTransactionStatus = "PARTIALLY_REFUNDED" SubscriptionCaptureStatusPending SubscriptionTransactionStatus = "PENDING" SubscriptionCaptureStatusRefunded SubscriptionTransactionStatus = "REFUNDED" )
type SubscriptionTransactionsResponse ¶
type SubscriptionTransactionsResponse struct { Transactions []SubscriptionCaptureResponse `json:"transactions"` }
type TaxInfo ¶
type TaxInfo struct { TaxID string `json:"tax_id,omitempty"` TaxIDType string `json:"tax_id_type,omitempty"` }
TaxInfo used for orders.
type TaxesOverride ¶ added in v4.5.0
type TaxesOverride struct { Percentage string `json:"percentage,omitempty"` Inclusive *bool `json:"inclusive,omitempty"` }
https://developer.paypal.com/docs/api/subscriptions/v1/#definition-payment_preferences_override
type TenureType ¶
type TenureType string
const ( TenureTypeRegular TenureType = "REGULAR" TenureTypeTrial TenureType = "TRIAL" )
type TextField ¶
type TextField struct { Is string // contains filtered or unexported fields }
TextField type
type ThirdPartyDetails ¶
type ThirdPartyDetails struct {
Features []string `json:"features"`
}
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 TransactionSearchRequest ¶
type TransactionSearchRequest struct { TransactionID *string TransactionType *string TransactionStatus *string TransactionAmount *string TransactionCurrency *string StartDate time.Time EndDate time.Time PaymentInstrumentType *string StoreID *string TerminalID *string Fields *string BalanceAffectingRecordsOnly *string PageSize *int Page *int }
type TransactionSearchResponse ¶
type TransactionSearchResponse struct { TransactionDetails []SearchTransactionDetails `json:"transaction_details"` AccountNumber string `json:"account_number"` StartDate JSONTime `json:"start_date"` EndDate JSONTime `json:"end_date"` LastRefreshDatetime JSONTime `json:"last_refreshed_datetime"` Page int `json:"page"` }
type UserAction ¶
type UserAction string
const ( UserActionContinue UserAction = "CONTINUE" UserActionPayNow UserAction = "PAY_NOW" UserActionSubscribeNow UserAction = "SUBSCRIBE_NOW" )
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 VerifyWebhookResponse ¶
type VerifyWebhookResponse struct {
VerificationStatus string `json:"verification_status,omitempty"`
}
VerifyWebhookResponse 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
type Webhook ¶
type Webhook struct { ID string `json:"id"` URL string `json:"url"` EventTypes []WebhookEventType `json:"event_types"` Links []Link `json:"links"` }
Webhook struct
type WebhookEventType ¶
type WebhookEventType struct { Name string `json:"name"` Description string `json:"description"` Status string `json:"status,omitempty"` }
WebhookEventType struct
type WebhookEventTypesResponse ¶
type WebhookEventTypesResponse struct {
EventTypes []WebhookEventType `json:"event_types"`
}