package paypal const ( baseurl = "https://api.sandbox.paypal.com" // sandbox //baseurl = "https://api.paypal.com"// product //sandbox username = "AR_HpVdxFURck7pjWsej_8CKbUAaAcKeEp4G7z6LdU1Vd-L5D5x_3Z6_vMVjhcWA5eZ7pbT9bTCwCD1S" password = "EL1gdqvwDaDCfj62C86LT3ptFgIJYsIrNg_lPpuepASe4P3za_Np3iOk_rytfU7SbYgXnSU7Z6WxxJot" // product //username = "ATefQ-JMD8VoIzBZUU50pJ9GMtn_fGWOt5E2jMl4f1AiKPUjle2XXPxADISx6de95am-g7FLmModG22G" //password = "EE1Y9XJUDIc1trwnU4UQDHVLeNUH9cuM5ehzohH1iAps7O9zH7k9sn6Awn-QYLH-aOYy4wwO5OXeV5LK" accessToken = "/v1/oauth2/token" // Authorization orderBase = "/v2/checkout/orders" // payouts = "/v1/payments/payouts" // ) type AccessToken struct { Scope string `json:"scope"` AccessToken string `json:"access_token"` TokenType string `json:"token_type"` AppID string `json:"app_id"` ExpiresIn int64 `json:"expires_in"` Nonce string `json:"nonce"` } type PurchaseAmount struct { Amount //Breakdown Breakdown `json:"breakdown"` // } type Amount struct { CurrencyCode string `json:"currency_code"` Value string `json:"value"` } type Breakdown struct { ItemTotal Amount `json:"item_total"` // Shipping Amount `json:"shipping"` // Handling Amount `json:"handling"` // TaxTotal Amount `json:"tax_total"` // Insurance Amount `json:"insurance"` // ShippingDiscount Amount `json:"shipping_discount"` // Discount Amount `json:"discount"` // } type PlatformFees struct { Amount Amount `json:"amount"` Payee Payee `json:"payee"` } type PaymentInstruction struct { PlatformFees []PlatformFees `json:"platform_fees"` PayeePricingTierId string `json:"payee_pricing_tier_id"` PayeeReceivableFxRateId string `json:"payee_receivable_fx_rate_id"` DisbursementMode string `json:"disbursement_mode"` } type Address struct { AddressLine1 string `json:"address_line_1"` AddressLine2 string `json:"address_line_2"` AdminArea1 string `json:"admin_area_1"` AdminArea2 string `json:"admin_area_2"` PostalCode string `json:"postal_code"` CountryCode string `json:"country_code"` // } type Name struct { GivenName string `json:"given_name"` Surname string `json:"surname"` } type Shipping struct { Type string `json:"type"` Name Name `json:"name"` Address Address `json:"address"` } type PurchaseUnit struct { //ReferenceId string `json:"reference_id"` //Description string `json:"description"` //CustomId string `json:"custom_id"` //InvoiceId string `json:"invoice_id"` //SoftDescriptor string `json:"soft_descriptor"` //Items []PurchaseItem `json:"items"` Amount PurchaseAmount `json:"amount"` // Payments struct { Captures []struct { ID string `json:"id"` Amount Amount `json:"amount"` } `json:"captures"` } `json:"payments"` //Payee Payee `json:"payee"` // //PaymentInstruction PaymentInstruction `json:"payment_instruction"` //Shipping struct { // Type string `json:"type"` // Name Name `json:"name"` // Address Address `json:"address"` //} `json:"shipping"` // //SupplementaryData struct { // Card struct { // Level2 struct { // InvoiceId string `json:"invoice_id"` // TaxTotal Amount `json:"tax_total"` // } `json:"level_2"` // Level3 struct { // ShipsFromPostalCode string `json:"ships_from_postal_code"` // LineItems []LineItems `json:"line_items"` // ShippingAmount Amount `json:"shipping_amount"` // DutyAmount Amount `json:"duty_amount"` // DiscountAmount Amount `json:"discount_amount"` // ShippingAddress Address `json:"shipping_address"` // } `json:"level_3"` // } `json:"card"` //} `json:"supplementary_data"` } type Payee struct { EmailAddress string `json:"email_address"` MerchantId string `json:"merchant_id"` } type PurchaseItem struct { Name string `json:"name"` // Quantity string `json:"quantity"` // Description string `json:"description"` // Sku string `json:"sku"` // Category string `json:"category"` // UnitAmount Amount `json:"unit_amount"` // Tax Amount `json:"tax"` // } type LineItems struct { PurchaseItem CommodityCode string `json:"commodity_code"` UnitOfMeasure string `json:"unit_of_measure"` DiscountAmount Amount `json:"discount_amount"` TotalAmount Amount `json:"total_amount"` } type PhoneNumber struct { NationalNumber string `json:"national_number"` } type Phone struct { //PhoneType string `json:"phone_type"` PhoneNumber PhoneNumber `json:"phone_number"` } type TaxInfo struct { TaxId string `json:"tax_id"` TaxIdType string `json:"tax_id_type"` } type Payer struct { EmailAddress string `json:"email_address"` Name Name `json:"name"` Phone Phone `json:"phone"` BirthDate string `json:"birth_date"` TaxInfo TaxInfo `json:"tax_info"` Address Address `json:"address"` } type Attribute struct { Customer struct { ID string `json:"id"` //EmailAddress string `json:"email_address"` //Phone Phone `json:"phone"` } `json:"customer"` //Vault struct { // StoreInVault string `json:"store_in_vault"` //} `json:"vault"` } type PreviousNetworkTransactionReference struct { ID string `json:"id"` Date string `json:"date"` AcquirerReferenceNumber string `json:"acquirer_reference_number"` Network string `json:"network"` } type TokenizedCard struct { Name string `json:"name"` Number string `json:"number"` SecurityCode string `json:"security_code"` Expiry string `json:"expiry"` BillingAddress Address `json:"billing_address"` Attributes Attribute `json:"attributes"` } type NetworkToken struct { Number string `json:"number"` Cryptogram string `json:"cryptogram"` TokenRequestorId string `json:"token_requestor_id"` Expiry string `json:"expiry"` EciFlag string `json:"eci_flag"` } type Card struct { TokenizedCard StoredCredential StoredCredential `json:"stored_credential"` VaultId string `json:"vault_id"` NetworkToken NetworkToken `json:"network_token"` } type Token struct { ID string `json:"id"` Type string `json:"type"` } type Experience struct { BrandName string `json:"brand_name"` ShippingPreference string `json:"shipping_preference"` } type ExperienceContext struct { //Experience //Locale string `json:"locale"` ReturnUrl string `json:"return_url"` CancelUrl string `json:"cancel_url"` } type PExperienceContext struct { ReturnURL string `json:"return_url,omitempty"` CancelURL string `json:"cancel_url,omitempty"` //LandingPage string `json:"landing_page"` //UserAction string `json:"user_action"` //PaymentMethodPreference string `json:"payment_method_preference"` } type Paypal struct { ExperienceContext PExperienceContext `json:"experience_context"` //BillingAgreementId string `json:"billing_agreement_id"` //VaultId string `json:"vault_id"` //EmailAddress string `json:"email_address"` //Name Name `json:"name"` //Phone Phone `json:"phone"` //BirthDate string `json:"birth_date"` //TaxInfo TaxInfo `json:"tax_info"` //Address Address `json:"address"` //Attributes Attribute `json:"attributes"` } type StoredCredential struct { PaymentInitiator string `json:"payment_initiator"` PaymentType string `json:"payment_type"` Usage string `json:"usage"` PreviousNetworkTransactionReference PreviousNetworkTransactionReference `json:"previous_network_transaction_reference"` } type PaymentSource struct { //Card Card `json:"card"` //Token Token `json:"token"` //Paypal Paypal `json:"paypal"` //Bancontact PaymentMethod `json:"bancontact"` //Blik PaymentMethodBlik `json:"blik"` //Eps PaymentMethod `json:"eps"` //Giropay PaymentMethod `json:"giropay"` //Ideal PaymentMethodIdeal `json:"ideal"` //Mybank PaymentMethod `json:"mybank"` //P24 PaymentMethodBlik `json:"p24"` //Sofort PaymentMethod `json:"sofort"` //Trustly PaymentMethod `json:"trustly"` //ApplePay ApplePay `json:"apple_pay"` //Venmo Venmo `json:"venmo"` } type ( ApplicationContext struct { BrandName string `json:"brand_name,omitempty"` Locale string `json:"locale,omitempty"` LandingPage string `json:"landing_page,omitempty"` ShippingPreference string `json:"shipping_preference,omitempty"` UserAction string `json:"user_action,omitempty"` ReturnURL string `json:"return_url,omitempty"` CancelURL string `json:"cancel_url,omitempty"` } CreateOrderRequest struct { PurchaseUnits []PurchaseUnit `json:"purchase_units"` Intent string `json:"intent"` //PaymentSource PaymentSource `json:"payment_source"`// 使用会带来PAYER_ACTION_REQUIRED问题 ApplicationContext ApplicationContext `json:"application_context"` } ) type Link struct { Href string `json:"href"` Rel string `json:"rel"` Method string `json:"method"` } type OrderDetail struct { CreateTime string `json:"create_time"` UpdateTime string `json:"update_time"` ID string `json:"id"` ProcessingInstruction string `json:"processing_instruction"` PurchaseUnits []PurchaseUnit `json:"purchase_units"` Links []Link `json:"links"` PaymentSource PaymentSource `json:"payment_source"` Intent string `json:"intent"` Payer Payer `json:"payer"` Status string `json:"status"` } type PaymentSourceRequest struct { PaymentSource PaymentSource `json:"payment_source"` } type PayoutPhone struct { CountryCode string `json:"country_code"` NationalNumber string `json:"national_number"` ExtensionNumber string `json:"extension_number"` } type PayoutAmount struct { Currency string `json:"currency"` Value string `json:"value"` } type PayoutItem struct { RecipientType string `json:"recipient_type"` Note string `json:"note"` Receiver string `json:"receiver"` //SenderItemId string `json:"sender_item_id"` //RecipientWallet string `json:"recipient_wallet"` Amount PayoutAmount `json:"amount"` //AlternateNotificationMethod PayoutPhone `json:"alternate_notification_method"` //NotificationLanguage string `json:"notification_language"` //ApplicationContext struct { // SocialFeedPrivacy string `json:"social_feed_privacy"` // HollerUrl string `json:"holler_url"` // LogoUrl string `json:"logo_url"` //} `json:"application_context"` } type PayoutRequest struct { Items []PayoutItem `json:"items"` SenderBatchHeader struct { SenderBatchId string `json:"sender_batch_id"` //RecipientType string `json:"recipient_type"` //EmailSubject string `json:"email_subject"` //EmailMessage string `json:"email_message"` //Note string `json:"note"` } `json:"sender_batch_header"` } type PayoutBatchHeader struct { PayoutBatchId string `json:"payout_batch_id"` TimeCreated string `json:"time_created"` BatchStatus string `json:"batch_status"` SenderBatchHeader struct { SenderBatchId string `json:"sender_batch_id"` EmailSubject string `json:"email_subject"` EmailMessage string `json:"email_message"` RecipientType string `json:"recipient_type"` } `json:"sender_batch_header"` } type PayoutResponse struct { Links []Link `json:"links"` BatchHeader PayoutBatchHeader `json:"batch_header"` } type ShowPayoutsRequest struct { Fields string `json:"fields"` Page int `json:"page"` PageSize int `json:"page_size"` TotalRequired bool `json:"total_required"` }