Documentation ¶
Index ¶
- Constants
- func Bool(v bool) *bool
- func Float(v float64) *float64
- func Int(v int) *int
- func IntValue(v *int) int64
- func RandUniform(min, max float64) float64
- func String(v string) *string
- func StringValue(v *string) string
- func WithAPIBase(apiBase string) serviceConfig
- func WithInitialDelay(initialDelay float64) serviceConfig
- func WithLogger(logger LoggerInterface) serviceConfig
- func WithMaxCount(maxCount int) serviceConfig
- func WithMaxDelay(maxDelay float64) serviceConfig
- type AccountResponse
- type AccountService
- type BalanceListParams
- type BalanceResponse
- type BalanceService
- type BankInfo
- type Card
- type CardListParams
- type CardResponse
- type Charge
- type ChargeListCaller
- func (c *ChargeListCaller) CustomerID(id string) *ChargeListCaller
- func (c *ChargeListCaller) Do() ([]*ChargeResponse, bool, error)
- func (c *ChargeListCaller) Limit(limit int) *ChargeListCaller
- func (c *ChargeListCaller) Offset(offset int) *ChargeListCaller
- func (c *ChargeListCaller) Since(since time.Time) *ChargeListCaller
- func (c *ChargeListCaller) SubscriptionID(id string) *ChargeListCaller
- func (c *ChargeListCaller) Until(until time.Time) *ChargeListCaller
- type ChargeListParams
- type ChargeResponse
- func (c *ChargeResponse) Capture(amount ...int) error
- func (c *ChargeResponse) Refund(reason string, amount ...int) error
- func (c *ChargeResponse) TdsFinish() error
- func (c *ChargeResponse) UnmarshalJSON(b []byte) error
- func (c *ChargeResponse) Update(description string, metadata ...map[string]string) error
- type ChargeService
- func (c ChargeService) All(params ...*ChargeListParams) ([]*ChargeResponse, bool, error)
- func (c ChargeService) Capture(chargeID string, amount ...int) (*ChargeResponse, error)
- func (c ChargeService) Create(amount int, charge Charge) (*ChargeResponse, error)
- func (c ChargeService) List() *ChargeListCaller
- func (c ChargeService) Refund(chargeID, reason string, amount ...int) (*ChargeResponse, error)
- func (c ChargeService) Retrieve(chargeID string) (*ChargeResponse, error)
- func (c ChargeService) TdsFinish(id string) (*ChargeResponse, error)
- func (c ChargeService) Update(chargeID, description string, metadata ...map[string]string) (*ChargeResponse, error)
- type Customer
- type CustomerCardListCaller
- func (c *CustomerCardListCaller) Do() ([]*CardResponse, bool, error)
- func (c *CustomerCardListCaller) Limit(limit int) *CustomerCardListCaller
- func (c *CustomerCardListCaller) Offset(offset int) *CustomerCardListCaller
- func (c *CustomerCardListCaller) Since(since time.Time) *CustomerCardListCaller
- func (c *CustomerCardListCaller) Until(until time.Time) *CustomerCardListCaller
- type CustomerListCaller
- func (c *CustomerListCaller) Do() ([]*CustomerResponse, bool, error)
- func (c *CustomerListCaller) Limit(limit int) *CustomerListCaller
- func (c *CustomerListCaller) Offset(offset int) *CustomerListCaller
- func (c *CustomerListCaller) Since(since time.Time) *CustomerListCaller
- func (c *CustomerListCaller) Until(until time.Time) *CustomerListCaller
- type CustomerListParams
- type CustomerResponse
- func (c *CustomerResponse) AddCardToken(token string, options ...Customer) (*CardResponse, error)
- func (c *CustomerResponse) AllCard(params ...*CardListParams) ([]*CardResponse, bool, error)
- func (c *CustomerResponse) Delete() error
- func (c CustomerResponse) DeleteCard(cardID string) error
- func (c *CustomerResponse) GetCard(cardID string) (*CardResponse, error)
- func (c *CustomerResponse) GetSubscription(subscriptionID string) (*SubscriptionResponse, error)
- func (c *CustomerResponse) ListCard() *CustomerCardListCaller
- func (c *CustomerResponse) ListSubscription() *subscriptionListCaller
- func (c *CustomerResponse) UnmarshalJSON(b []byte) error
- func (c *CustomerResponse) Update(customer Customer) error
- func (c CustomerResponse) UpdateCard(cardID string, card Card) (*CardResponse, error)
- type CustomerService
- func (c CustomerService) AddCardToken(id string, token string, options ...Customer) (*CardResponse, error)
- func (c CustomerService) All(params ...*CustomerListParams) ([]*CustomerResponse, bool, error)
- func (c CustomerService) Create(customer Customer) (*CustomerResponse, error)
- func (c CustomerService) Delete(id string) error
- func (c CustomerService) DeleteCard(customerID, cardID string) error
- func (c CustomerService) GetCard(id, cardID string) (*CardResponse, error)
- func (c CustomerService) GetSubscription(customerID, subscriptionID string) (*SubscriptionResponse, error)
- func (c CustomerService) List() *CustomerListCaller
- func (c CustomerService) ListCard(id string) *CustomerCardListCaller
- func (c CustomerService) ListSubscription(customerID string) *subscriptionListCaller
- func (c CustomerService) Retrieve(id string) (*CustomerResponse, error)
- func (c CustomerService) Update(id string, customer Customer) (*CustomerResponse, error)
- func (c CustomerService) UpdateCard(id string, cardID string, card Card) (*CardResponse, error)
- type DeleteResponse
- type Error
- type EventListCaller
- func (e *EventListCaller) Do() ([]*EventResponse, bool, error)
- func (e *EventListCaller) Limit(limit int) *EventListCaller
- func (e *EventListCaller) Object(object string) *EventListCaller
- func (e *EventListCaller) Offset(offset int) *EventListCaller
- func (e *EventListCaller) ResourceID(id string) *EventListCaller
- func (e *EventListCaller) Since(since time.Time) *EventListCaller
- func (e *EventListCaller) Type(p string) *EventListCaller
- func (e *EventListCaller) Until(until time.Time) *EventListCaller
- type EventListParams
- type EventResponse
- type EventService
- type ListParams
- type LogLevel
- type LoggerInterface
- type PayjpLogger
- type Plan
- type PlanListParams
- type PlanResponse
- type PlanService
- func (c PlanService) All(params ...*PlanListParams) ([]*PlanResponse, bool, error)
- func (p PlanService) Create(plan Plan) (*PlanResponse, error)
- func (p PlanService) Delete(id string) error
- func (p PlanService) List() *planListCaller
- func (p PlanService) Retrieve(id string) (*PlanResponse, error)
- func (p PlanService) Update(id string, plan Plan) (*PlanResponse, error)
- type Service
- type StatementItem
- type StatementListParams
- type StatementResponse
- type StatementService
- type StatementUrlResponse
- type StatementUrls
- type Subscription
- type SubscriptionDelete
- type SubscriptionListParams
- type SubscriptionResponse
- func (s *SubscriptionResponse) Cancel() error
- func (s *SubscriptionResponse) Delete(params ...SubscriptionDelete) error
- func (s *SubscriptionResponse) Pause() error
- func (s *SubscriptionResponse) Resume(subscription Subscription) error
- func (s *SubscriptionResponse) UnmarshalJSON(b []byte) error
- func (s *SubscriptionResponse) Update(subscription Subscription) error
- type SubscriptionService
- func (c SubscriptionService) All(params ...*SubscriptionListParams) ([]*SubscriptionResponse, bool, error)
- func (s SubscriptionService) Cancel(subscriptionID string) (*SubscriptionResponse, error)
- func (s SubscriptionService) Delete(subscriptionID string, params ...SubscriptionDelete) error
- func (s SubscriptionService) List() *subscriptionListCaller
- func (s SubscriptionService) Pause(subscriptionID string) (*SubscriptionResponse, error)
- func (s SubscriptionService) Resume(subscriptionID string, subscription Subscription) (*SubscriptionResponse, error)
- func (s SubscriptionService) Retrieve(customerID, id string) (*SubscriptionResponse, error)
- func (s SubscriptionService) Subscribe(customerID string, subscription Subscription) (*SubscriptionResponse, error)
- func (s SubscriptionService) Update(subscriptionID string, subscription Subscription) (*SubscriptionResponse, error)
- type SubscriptionStatus
- type TermListParams
- type TermResponse
- type TermService
- type Token
- type TokenResponse
- type TokenService
- type TransferChargeListCaller
- func (c *TransferChargeListCaller) CustomerID(ID string) *TransferChargeListCaller
- func (c *TransferChargeListCaller) Do() ([]*ChargeResponse, bool, error)
- func (c *TransferChargeListCaller) Limit(limit int) *TransferChargeListCaller
- func (c *TransferChargeListCaller) Offset(offset int) *TransferChargeListCaller
- func (c *TransferChargeListCaller) Since(since time.Time) *TransferChargeListCaller
- func (c *TransferChargeListCaller) Until(until time.Time) *TransferChargeListCaller
- type TransferChargeListParams
- type TransferListParams
- type TransferResponse
- type TransferService
- type TransferStatus
Constants ¶
const ( // SubscriptionActive はアクティブ状態を表す定数 SubscriptionActive = SubscriptionStatus("active") // SubscriptionTrial はトライアル状態を表す定数 SubscriptionTrial = SubscriptionStatus("trial") // SubscriptionCanceled はキャンセル状態を表す定数 SubscriptionCanceled = SubscriptionStatus("canceled") // SubscriptionPaused は停止状態を表す定数 SubscriptionPaused = SubscriptionStatus("paused") )
const ( // TransferPending は支払い前のステータスを表す定数 TransferPending = TransferStatus("pending") // TransferPaid は支払い済みのステータスを表す定数 TransferPaid = TransferStatus("paid") // TransferFailed は支払い失敗のステータスを表す定数 TransferFailed = TransferStatus("failed") // TransferRecombination は組戻ステータスを表す定数 TransferRecombination = TransferStatus("recombination") // TransferCarriedOver は入金繰り越しを表す定数 TransferCarriedOver = TransferStatus("carried_over") // TransferStop は入金停止を表す定数 TransferStop = TransferStatus("stop") )
const Version = "v0.2.1"
Variables ¶
This section is empty.
Functions ¶
func IntValue ¶ added in v0.1.0
IntValue returns the value of the int64 pointer passed in or 0 if the pointer is nil.
func RandUniform ¶ added in v0.2.1
func StringValue ¶ added in v0.1.0
StringValue returns the value of the string pointer passed in or "" if the pointer is nil.
func WithAPIBase ¶ added in v0.2.1
func WithAPIBase(apiBase string) serviceConfig
WithAPIBase はAPIのエントリーポイントを変更するために使用します。
func WithInitialDelay ¶ added in v0.2.1
func WithInitialDelay(initialDelay float64) serviceConfig
WithInitialDelay はリクエストリトライ時の初期遅延時間を変更するために使用します。
func WithLogger ¶ added in v0.2.1
func WithLogger(logger LoggerInterface) serviceConfig
WithLogger はログ出力を変更するために使用します。
デフォルトではログは出力されません。 LoggerInterfaceを実装した構造体を渡すことでログ出力を変更できます。
func WithMaxCount ¶ added in v0.2.1
func WithMaxCount(maxCount int) serviceConfig
WithMaxCount はリクエストのリトライ回数を変更するために使用します。
func WithMaxDelay ¶ added in v0.2.1
func WithMaxDelay(maxDelay float64) serviceConfig
WithMaxDelay はリクエストリトライ時の最大遅延時間を変更するために使用します。
Types ¶
type AccountResponse ¶
type AccountResponse struct { CreatedAt time.Time // このアカウント作成時のタイムスタンプ Created *int `json:"created"` Email string `json:"email"` ID string `json:"id"` Merchant struct { BankEnabled bool `json:"bank_enabled"` BrandsAccepted []string `json:"brands_accepted"` BusinessType string `json:"business_type"` ChargeType []string `json:"charge_type"` ContactPhone string `json:"contact_phone"` Country string `json:"country"` Created *int `json:"created"` CreatedAt time.Time // 作成時のタイムスタンプ CurrenciesSupported []string `json:"currencies_supported"` DefaultCurrency string `json:"default_currency"` DetailsSubmitted bool `json:"details_submitted"` ID string `json:"id"` RawLiveModeActivatedAt *int `json:"livemode_activated_at"` LiveModeActivatedAt time.Time LiveModeEnabled bool `json:"livemode_enabled"` Object string `json:"object"` ProductDetail string `json:"product_detail"` ProductName string `json:"product_name"` ProductType []string `json:"product_type"` SitePublished bool `json:"site_published"` URL string `json:"url"` } `json:"merchant"` Object string `json:"object"` TeamID string `json:"team_id"` // contains filtered or unexported fields }
AccountResponse はAccount.Retrieve()メソッドが返す構造体です
func (*AccountResponse) UnmarshalJSON ¶
func (a *AccountResponse) UnmarshalJSON(b []byte) error
UnmarshalJSON はJSONパース用の内部APIです。
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
AccountService はあなたのアカウント情報を返します。
func (*AccountService) Retrieve ¶
func (t *AccountService) Retrieve() (*AccountResponse, error)
Retrieve account object. あなたのアカウント情報を取得します。
type BalanceListParams ¶ added in v0.2.0
type BalanceResponse ¶ added in v0.2.0
type BalanceResponse struct { ID string `json:"id"` LiveMode bool `json:"livemode"` Created *int `json:"created"` CreatedAt time.Time Net int64 `json:"net"` Type string `json:"type"` Closed bool `json:"closed"` Statements []*StatementResponse RawStatements listResponseParser `json:"statements"` DueDate string `json:"due_date"` BankInfo *BankInfo `json:"bank_info"` Object string `json:"object"` // contains filtered or unexported fields }
func (*BalanceResponse) UnmarshalJSON ¶ added in v0.2.0
func (t *BalanceResponse) UnmarshalJSON(b []byte) error
type BalanceService ¶ added in v0.2.0
type BalanceService struct {
// contains filtered or unexported fields
}
func (BalanceService) All ¶ added in v0.2.0
func (c BalanceService) All(params ...*BalanceListParams) ([]*BalanceResponse, bool, error)
func (BalanceService) Retrieve ¶ added in v0.2.0
func (t BalanceService) Retrieve(id string) (*BalanceResponse, error)
Retrieve transfer object. 入金情報を取得します。
type BankInfo ¶ added in v0.2.0
type BankInfo struct { BankCode string `json:"bank_code"` BankBranchCode string `json:"bank_branch_code"` BankAccountType string `json:"bank_account_type"` BankAccountNumber string `json:"bank_account_number"` BankAccountHolderName string `json:"bank_account_holder_name"` BankAccountStatus string `json:"bank_account_status"` }
type Card ¶
type Card struct { Name interface{} // カード保有者名(e.g. YUI ARAGAKI) Country interface{} // 2桁のISOコード(e.g. JP) AddressZip interface{} // 郵便番号 AddressState interface{} // 都道府県 AddressCity interface{} // 市区町村 AddressLine1 interface{} // 番地など AddressLine2 interface{} // 建物名など Metadata map[string]string // メタデータ }
Card はCustomerやTokenのAPIでカード情報を設定する時に使う構造体です
type CardListParams ¶ added in v0.1.0
type CardListParams struct {
ListParams `form:"*"`
}
type CardResponse ¶
type CardResponse struct { CreatedAt time.Time // カード作成時のタイムスタンプ Created *int `json:"created"` AddressCity string `json:"address_city"` AddressLine1 string `json:"address_line1"` AddressLine2 string `json:"address_line2"` AddressState string `json:"address_state"` AddressZip string `json:"address_zip"` AddressZipCheck string `json:"address_zip_check"` Brand string `json:"brand"` Country string `json:"country"` CvcCheck string `json:"cvc_check"` ExpMonth int `json:"exp_month"` ExpYear int `json:"exp_year"` Fingerprint string `json:"fingerprint"` ID string `json:"id"` Last4 string `json:"last4"` Name string `json:"name"` LiveMode bool `json:"livemode"` Object string `json:"object"` Metadata map[string]string `json:"metadata"` ThreeDSecureStatus *string `json:"three_d_secure_status"` // contains filtered or unexported fields }
CardResponse はCustomerやTokenのAPIが返す構造体です
func (*CardResponse) Delete ¶
func (c *CardResponse) Delete() error
Delete メソッドは顧客に登録されているカードを削除します Customer情報から得られるカードでしか削除はできません
func (*CardResponse) UnmarshalJSON ¶
func (c *CardResponse) UnmarshalJSON(b []byte) error
UnmarshalJSON はJSONパース用の内部APIです。
func (*CardResponse) Update ¶
func (c *CardResponse) Update(card Card) error
Update メソッドはカードの内容を更新します Customer情報から得られるカードでしか更新はできません
type Charge ¶
type Charge struct { Currency string // 必須: 3文字のISOコード(現状 “jpy” のみサポート) Product interface{} // プロダクトID (指定された場合、amountとcurrencyは無視されます) CustomerID string // 顧客ID (CardかCustomerのどちらかは必須パラメータ) CardToken string // トークンID (CardかCustomerのどちらかは必須パラメータ) CustomerCardID string // 顧客のカードID Capture bool // 支払い処理を確定するかどうか Description string // 任意の文字列 ExpireDays interface{} // 認証状態が失効するまでの日数 ThreeDSecure *bool // 3DSecureを実施するか否か Metadata map[string]string // メタデータ }
Charge 構造体はCharge.Createのパラメータを設定するのに使用します
type ChargeListCaller ¶
type ChargeListCaller struct { ChargeListParams // contains filtered or unexported fields }
func (*ChargeListCaller) CustomerID ¶
func (c *ChargeListCaller) CustomerID(id string) *ChargeListCaller
CustomerID を指定すると、指定した顧客の支払いのみを取得します
func (*ChargeListCaller) Do ¶
func (c *ChargeListCaller) Do() ([]*ChargeResponse, bool, error)
func (*ChargeListCaller) Limit ¶
func (c *ChargeListCaller) Limit(limit int) *ChargeListCaller
Limit はリストの要素数の最大値を設定します(1-100)
func (*ChargeListCaller) Offset ¶
func (c *ChargeListCaller) Offset(offset int) *ChargeListCaller
Offset は取得するリストの先頭要素のインデックスのオフセットを設定します
func (*ChargeListCaller) Since ¶
func (c *ChargeListCaller) Since(since time.Time) *ChargeListCaller
Since はここに指定したタイムスタンプ以降に作成されたデータを取得します
func (*ChargeListCaller) SubscriptionID ¶
func (c *ChargeListCaller) SubscriptionID(id string) *ChargeListCaller
SubscriptionID を指定すると、指定した定期購読の支払いのみを取得します
func (*ChargeListCaller) Until ¶
func (c *ChargeListCaller) Until(until time.Time) *ChargeListCaller
Until はここに指定したタイムスタンプ以前に作成されたデータを取得します
type ChargeListParams ¶ added in v0.1.0
type ChargeListParams struct { ListParams `form:"*"` Customer *string `form:"customer"` Subscription *string `form:"subscription"` Tenant *string `form:"tenant"` Term *string `form:"term"` }
type ChargeResponse ¶
type ChargeResponse struct { ID string `json:"id"` // ch_で始まる一意なオブジェクトを示す文字列 LiveMode bool `json:"livemode"` // 本番環境かどうか Created *int `json:"created"` // この支払い作成時のタイムスタンプ CreatedAt time.Time // この支払い作成時のタイムスタンプ Amount int `json:"amount"` // 支払額 Currency string `json:"currency"` // 3文字のISOコード(現状 “jpy” のみサポート) Paid bool `json:"paid"` // 認証処理が成功しているかどうか。 RawExpiredAt *int `json:"expired_at"` // 認証状態が自動的に失効される日時のタイムスタンプ ExpiredAt time.Time // 認証状態が自動的に失効される日時のタイムスタンプ Captured bool `json:"captured"` // 支払い処理を確定しているかどうか RawCapturedAt *int `json:"captured_at"` // 支払い処理確定時のタイムスタンプ CapturedAt time.Time // 支払い処理確定時のタイムスタンプ RawCard json.RawMessage `json:"card"` // 支払いされたクレジットカードの情報 Card CardResponse // 支払いされたクレジットカードの情報 Customer *string `json:"customer"` // 顧客ID CustomerID string // 顧客ID RawDescription *string `json:"description"` // 概要 Description string RawFailureCode *string `json:"failure_code"` // 失敗した支払いのエラーコード RawFailureMessage *string `json:"failure_message"` // 失敗した支払いの説明 FailureCode string // 失敗した支払いのエラーコード FailureMessage string // 失敗した支払いの説明 Refunded bool `json:"refunded"` // 返金済みかどうか AmountRefunded int `json:"amount_refunded"` // この支払いに対しての返金額 RawRefundReason *string `json:"refund_reason"` // 返金理由 RefundReason string // 返金理由 Subscription *string `json:"subscription"` // sub_から始まる定期課金のID SubscriptionID string Metadata map[string]string `json:"metadata"` FeeRate string `json:"fee_rate"` // 決済手数料率 ThreeDSecureStatus *string `json:"three_d_secure_status"` // 3Dセキュアの実施状況 TermID string `json:"term_id"` // TermオブジェクトID Object string `json:"object"` // contains filtered or unexported fields }
ChargeResponse はCharge.Getなどで返される、支払いに関する情報を持った構造体です
func (*ChargeResponse) Capture ¶
func (c *ChargeResponse) Capture(amount ...int) error
Capture は認証状態となった処理待ちの支払い処理を確定させます。具体的には Captured="false" となった支払いが該当します。
amount をセットすることで、支払い生成時の金額と異なる金額の支払い処理を行うことができます。 ただし amount は、支払い生成時の金額よりも少額である必要があるためご注意ください。
amount をセットした場合、AmountRefunded に認証時の amount との差額が入ります。
例えば、認証時に amount=500 で作成し、 amount=400 で支払い確定を行った場合、 AmountRefunded=100 となり、確定金額が400円に変更された状態で支払いが確定されます。
func (*ChargeResponse) Refund ¶
func (c *ChargeResponse) Refund(reason string, amount ...int) error
Refund 支払い済みとなった処理を返金します。 全額返金、及び amount を指定することで金額の部分返金を行うことができます。ただし部分返金を最初に行った場合、2度目の返金は全額返金しか行うことができないため、ご注意ください。
func (*ChargeResponse) TdsFinish ¶ added in v0.1.0
func (c *ChargeResponse) TdsFinish() error
TdsFinish をChrgeResponseから実行します。
func (*ChargeResponse) UnmarshalJSON ¶
func (c *ChargeResponse) UnmarshalJSON(b []byte) error
UnmarshalJSON はJSONパース用の内部APIです。
type ChargeService ¶
type ChargeService struct {
// contains filtered or unexported fields
}
ChargeService 都度の支払いや定期購入の引き落としのときに生成される、支払い情報を取り扱います。
func (ChargeService) All ¶ added in v0.1.0
func (c ChargeService) All(params ...*ChargeListParams) ([]*ChargeResponse, bool, error)
func (ChargeService) Capture ¶
func (c ChargeService) Capture(chargeID string, amount ...int) (*ChargeResponse, error)
Capture は認証状態となった処理待ちの支払い処理を確定させます。具体的には Captured="false" となった支払いが該当します。
amount をセットすることで、支払い生成時の金額と異なる金額の支払い処理を行うことができます。 ただし amount は、支払い生成時の金額よりも少額である必要があるためご注意ください。
amount をセットした場合、AmountRefunded に認証時の amount との差額が入ります。
例えば、認証時に amount=500 で作成し、 amount=400 で支払い確定を行った場合、 AmountRefunded=100 となり、確定金額が400円に変更された状態で支払いが確定されます。
func (ChargeService) Create ¶
func (c ChargeService) Create(amount int, charge Charge) (*ChargeResponse, error)
Create はトークンID、カードを保有している顧客IDのいずれかのパラメーターを指定して支払いを作成します。 顧客IDを使って支払いを作成する場合は CustomerCardID に顧客の保有するカードのIDを指定でき、省略された場合はデフォルトカードとして登録されているものが利用されます。 テスト用のキーでは、本番用の決済ネットワークへは接続されず、実際の請求が行われることもありません。 本番用のキーでは、決済ネットワークで処理が行われ、実際の請求が行われます。
支払いを確定せずに、カードの認証と支払い額のみ確保する場合は、 Capture に false を指定してください。 このとき ExpireDays を指定することで、認証の期間を定めることができます。 ExpireDays はデフォルトで7日となっており、1日~60日の間で設定が可能です。
func (ChargeService) Refund ¶
func (c ChargeService) Refund(chargeID, reason string, amount ...int) (*ChargeResponse, error)
Refund は支払い済みとなった処理を返金します。 Amount省略時は全額返金、指定時に金額の部分返金を行うことができます。
func (ChargeService) Retrieve ¶
func (c ChargeService) Retrieve(chargeID string) (*ChargeResponse, error)
Retrieve charge object. 支払い情報を取得します。
func (ChargeService) TdsFinish ¶ added in v0.1.0
func (c ChargeService) TdsFinish(id string) (*ChargeResponse, error)
TdsFinish は3Dセキュア認証が終了した支払いに対し、決済を行います。 https://pay.jp/docs/api/#3d%E3%82%BB%E3%82%AD%E3%83%A5%E3%82%A2%E3%83%95%E3%83%AD%E3%83%BC%E3%82%92%E5%AE%8C%E4%BA%86%E3%81%99%E3%82%8B
func (ChargeService) Update ¶
func (c ChargeService) Update(chargeID, description string, metadata ...map[string]string) (*ChargeResponse, error)
Update は支払い情報のDescriptionを更新します。
type Customer ¶
type Customer struct { Email interface{} // メールアドレス Description interface{} // 概要 ID interface{} // 一意の顧客ID CardToken interface{} // トークンID DefaultCard interface{} // デフォルトカード Metadata map[string]string // メタデータ }
Customer は顧客の登録や更新時に使用する構造体です
type CustomerCardListCaller ¶
type CustomerCardListCaller struct { CardListParams // contains filtered or unexported fields }
CustomerCardListCaller はカードのリスト取得に使用する構造体です。
func (*CustomerCardListCaller) Do ¶
func (c *CustomerCardListCaller) Do() ([]*CardResponse, bool, error)
Do は指定されたクエリーを元に支払いのリストを配列で取得します。
func (*CustomerCardListCaller) Limit ¶
func (c *CustomerCardListCaller) Limit(limit int) *CustomerCardListCaller
Limit はリストの要素数の最大値を設定します(1-100)
func (*CustomerCardListCaller) Offset ¶
func (c *CustomerCardListCaller) Offset(offset int) *CustomerCardListCaller
Offset は取得するリストの先頭要素のインデックスのオフセットを設定します
func (*CustomerCardListCaller) Since ¶
func (c *CustomerCardListCaller) Since(since time.Time) *CustomerCardListCaller
Since はここに指定したタイムスタンプ以降に作成されたデータを取得します
func (*CustomerCardListCaller) Until ¶
func (c *CustomerCardListCaller) Until(until time.Time) *CustomerCardListCaller
Until はここに指定したタイムスタンプ以前に作成されたデータを取得します
type CustomerListCaller ¶
type CustomerListCaller struct { CustomerListParams // contains filtered or unexported fields }
func (*CustomerListCaller) Do ¶
func (c *CustomerListCaller) Do() ([]*CustomerResponse, bool, error)
Do は指定されたクエリーを元に顧客のリストを配列で取得します。
func (*CustomerListCaller) Limit ¶
func (c *CustomerListCaller) Limit(limit int) *CustomerListCaller
Limit はリストの要素数の最大値を設定します(1-100)
func (*CustomerListCaller) Offset ¶
func (c *CustomerListCaller) Offset(offset int) *CustomerListCaller
Offset は取得するリストの先頭要素のインデックスのオフセットを設定します
func (*CustomerListCaller) Since ¶
func (c *CustomerListCaller) Since(since time.Time) *CustomerListCaller
Since はここに指定したタイムスタンプ以降に作成されたデータを取得します
func (*CustomerListCaller) Until ¶
func (c *CustomerListCaller) Until(until time.Time) *CustomerListCaller
Until はここに指定したタイムスタンプ以前に作成されたデータを取得します
type CustomerListParams ¶ added in v0.1.0
type CustomerListParams struct {
ListParams `form:"*"`
}
type CustomerResponse ¶
type CustomerResponse struct { RawCards listResponseParser `json:"cards"` Cards []*CardResponse DefaultCard string `json:"default_card"` Description string `json:"description"` Email string `json:"email"` ID string `json:"id"` LiveMode bool `json:"livemode"` Object string `json:"object"` RawSubscriptions listResponseParser `json:"subscriptions"` Subscriptions []*SubscriptionResponse Metadata map[string]string `json:"metadata"` Created *int `json:"created"` CreatedAt time.Time // contains filtered or unexported fields }
CustomerResponse はCustomerService.GetやCustomerService.Listで返される顧客を表す構造体です
func (*CustomerResponse) AddCardToken ¶
func (c *CustomerResponse) AddCardToken(token string, options ...Customer) (*CardResponse, error)
AddCardToken をCustomerResponseから実行します。
func (*CustomerResponse) AllCard ¶ added in v0.1.0
func (c *CustomerResponse) AllCard(params ...*CardListParams) ([]*CardResponse, bool, error)
func (*CustomerResponse) Delete ¶
func (c *CustomerResponse) Delete() error
Delete は生成した顧客情報を削除します。削除した顧客情報は、もう一度生成することができないためご注意ください。
func (CustomerResponse) DeleteCard ¶
func (c CustomerResponse) DeleteCard(cardID string) error
DeleteCard は顧客の特定のカードを削除します。
func (*CustomerResponse) GetCard ¶
func (c *CustomerResponse) GetCard(cardID string) (*CardResponse, error)
GetCard は顧客の特定のカード情報を取得します。
func (*CustomerResponse) GetSubscription ¶
func (c *CustomerResponse) GetSubscription(subscriptionID string) (*SubscriptionResponse, error)
GetSubscription は顧客の特定の定期課金情報を取得します。
func (*CustomerResponse) ListCard ¶
func (c *CustomerResponse) ListCard() *CustomerCardListCaller
ListCard は顧客の保持しているカードリストを取得します。リストは、直近で生成された順番に取得されます。
func (*CustomerResponse) ListSubscription ¶
func (c *CustomerResponse) ListSubscription() *subscriptionListCaller
deprecated
func (*CustomerResponse) UnmarshalJSON ¶
func (c *CustomerResponse) UnmarshalJSON(b []byte) error
func (*CustomerResponse) Update ¶
func (c *CustomerResponse) Update(customer Customer) error
Update は生成した顧客情報を更新したり、新たなカードを顧客に追加することができます。
また default_card に保持しているカードIDを指定することで、メイン利用のカードを変更することもできます。
func (CustomerResponse) UpdateCard ¶
func (c CustomerResponse) UpdateCard(cardID string, card Card) (*CardResponse, error)
UpdateCard は顧客の特定のカード情報を更新します。
type CustomerService ¶
type CustomerService struct {
// contains filtered or unexported fields
}
CustomerService は顧客を管理する機能を提供します。
顧客における都度の支払いや定期購入、複数カードの管理など、さまざまなことができます。 作成した顧客は、あとからカードを追加・更新・削除したり、顧客自体を削除することができます。
func (CustomerService) AddCardToken ¶
func (c CustomerService) AddCardToken(id string, token string, options ...Customer) (*CardResponse, error)
AddCardToken はトークンIDを指定して、新たにカードを追加します。
func (CustomerService) All ¶ added in v0.1.0
func (c CustomerService) All(params ...*CustomerListParams) ([]*CustomerResponse, bool, error)
func (CustomerService) Create ¶
func (c CustomerService) Create(customer Customer) (*CustomerResponse, error)
Create はメールアドレスやIDなどを指定して顧客を作成します。 https://pay.jp/docs/api/?go#顧客を作成
func (CustomerService) Delete ¶
func (c CustomerService) Delete(id string) error
Delete は生成した顧客情報を削除します。削除した顧客情報は、もう一度生成することができないためご注意ください。
func (CustomerService) DeleteCard ¶
func (c CustomerService) DeleteCard(customerID, cardID string) error
DeleteCard は顧客の特定のカードを削除します。
func (CustomerService) GetCard ¶
func (c CustomerService) GetCard(id, cardID string) (*CardResponse, error)
GetCard は顧客の特定のカード情報を取得します。
func (CustomerService) GetSubscription ¶
func (c CustomerService) GetSubscription(customerID, subscriptionID string) (*SubscriptionResponse, error)
GetSubscription は顧客の特定の定期課金情報を取得します。
func (CustomerService) ListCard ¶
func (c CustomerService) ListCard(id string) *CustomerCardListCaller
deprecated
func (CustomerService) ListSubscription ¶
func (c CustomerService) ListSubscription(customerID string) *subscriptionListCaller
ListSubscription は顧客の定期課金リストを取得します。リストは、直近で生成された順番に取得されます。
func (CustomerService) Retrieve ¶
func (c CustomerService) Retrieve(id string) (*CustomerResponse, error)
Retrieve customer object. 顧客情報を取得します。 https://pay.jp/docs/api/?go#顧客情報を取得
func (CustomerService) Update ¶
func (c CustomerService) Update(id string, customer Customer) (*CustomerResponse, error)
Update は生成した顧客情報を更新したり、新たなカードを顧客に追加します。 https://pay.jp/docs/api/?go#顧客情報を更新
func (CustomerService) UpdateCard ¶
func (c CustomerService) UpdateCard(id string, cardID string, card Card) (*CardResponse, error)
UpdateCard は顧客の特定のカード情報を更新します。
type DeleteResponse ¶
type DeleteResponse struct { Deleted bool `json:"deleted"` ID string `json:"id"` LiveMode bool `json:"livemode"` }
DeleteResponse
type Error ¶
type Error struct { Code string `json:"code"` Message string `json:"message"` Param string `json:"param"` Status int `json:"status"` Type string `json:"type"` }
Error はPAY.JP固有のエラーを表す構造体です
type EventListCaller ¶
type EventListCaller struct { EventListParams // contains filtered or unexported fields }
func (*EventListCaller) Do ¶
func (e *EventListCaller) Do() ([]*EventResponse, bool, error)
func (*EventListCaller) Limit ¶
func (e *EventListCaller) Limit(limit int) *EventListCaller
Limit はリストの要素数の最大値を設定します(1-100)
func (*EventListCaller) Object ¶
func (e *EventListCaller) Object(object string) *EventListCaller
Object は取得するeventに紐づくAPIリソースのオブジェクト名を設定します (e.g. customer, charge)
func (*EventListCaller) Offset ¶
func (e *EventListCaller) Offset(offset int) *EventListCaller
Offset は取得するリストの先頭要素のインデックスのオフセットを設定します
func (*EventListCaller) ResourceID ¶
func (e *EventListCaller) ResourceID(id string) *EventListCaller
ResourceID は取得するeventに紐づくAPIリソースのIDを設定します (e.g. customer.id)
func (*EventListCaller) Since ¶
func (e *EventListCaller) Since(since time.Time) *EventListCaller
Since はここに指定したタイムスタンプ以降に作成されたデータを取得します
func (*EventListCaller) Type ¶
func (e *EventListCaller) Type(p string) *EventListCaller
Type は取得するeventのtypeを設定します
func (*EventListCaller) Until ¶
func (e *EventListCaller) Until(until time.Time) *EventListCaller
Until はここに指定したタイムスタンプ以前に作成されたデータを取得します
type EventListParams ¶ added in v0.1.0
type EventListParams struct { ListParams `form:"*"` ResourceID *string `form:"resource_id"` Type *string `form:"type"` Object *string `form:"object"` }
type EventResponse ¶
type EventResponse struct { CreatedAt time.Time Created *int `json:"created"` // この支払い作成時のタイムスタンプ ID string `json:"id"` LiveMode bool `json:"livemode"` Type string `json:"type"` PendingWebHooks int `json:"pending_webhooks"` Object string `json:"object"` Data json.RawMessage `json:"data"` DataMap map[string]interface{} // contains filtered or unexported fields }
EventResponse は、EventService.Retrieve()/EventService.List()が返す構造体です。
func (*EventResponse) GetDataValue ¶ added in v0.1.0
func (e *EventResponse) GetDataValue(keys ...string) (string, error)
func (*EventResponse) UnmarshalJSON ¶
func (e *EventResponse) UnmarshalJSON(b []byte) error
UnmarshalJSON はJSONパース用の内部APIです。
type EventService ¶
type EventService struct {
// contains filtered or unexported fields
}
EventService は作成、更新、削除などのイベントを表示するサービスです。
func (EventService) All ¶ added in v0.1.0
func (e EventService) All(params ...*EventListParams) ([]*EventResponse, bool, error)
func (EventService) List ¶
func (c EventService) List() *EventListCaller
List はイベントリストを取得します。リストは、直近で生成された順番に取得されます。
func (EventService) Retrieve ¶
func (e EventService) Retrieve(id string) (*EventResponse, error)
Retrieve event object. 特定のイベント情報を取得します。
type ListParams ¶ added in v0.1.0
type LoggerInterface ¶ added in v0.2.1
type LoggerInterface interface { Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warnf(format string, args ...interface{}) Errorf(format string, args ...interface{}) }
LoggerInterface はログ出力を行うためのインターフェースです。
var NullLogger LoggerInterface = NewPayjpLogger(LogLevelNull)
NullLogger はログを出力しないロガーです。
type PayjpLogger ¶ added in v0.2.1
type PayjpLogger struct {
// contains filtered or unexported fields
}
func NewPayjpLogger ¶ added in v0.2.1
func NewPayjpLogger(logLevel LogLevel) *PayjpLogger
NewPayjpLogger はPayjpLoggerを生成します。 ログの出力レベルを指定することができます。
func (*PayjpLogger) Debugf ¶ added in v0.2.1
func (l *PayjpLogger) Debugf(format string, args ...interface{})
func (*PayjpLogger) Errorf ¶ added in v0.2.1
func (l *PayjpLogger) Errorf(format string, args ...interface{})
func (*PayjpLogger) Infof ¶ added in v0.2.1
func (l *PayjpLogger) Infof(format string, args ...interface{})
func (*PayjpLogger) Warnf ¶ added in v0.2.1
func (l *PayjpLogger) Warnf(format string, args ...interface{})
type Plan ¶
type Plan struct { Amount int // 必須: 金額。50~9,999,999の整数 Currency string // 3文字のISOコード(現状 “jpy” のみサポート) Interval string // 月次など ID string // プランID Name string // プランの名前 TrialDays int // トライアル日数 BillingDay int // 支払いの実行日(1〜31) Metadata map[string]string // メタデータ }
Plan はプランの作成時に使用する構造体です。
type PlanListParams ¶ added in v0.1.0
type PlanListParams struct {
ListParams `form:"*"`
}
PlanListCaller はプランのリスト取得に使用する構造体です。
type PlanResponse ¶
type PlanResponse struct { CreatedAt time.Time // このプラン作成時のタイムスタンプ Amount int `json:"amount"` BillingDay int `json:"billing_day"` Created *int `json:"created"` Currency string `json:"currency"` ID string `json:"id"` Interval string `json:"interval"` LiveMode bool `json:"livemode"` Name string `json:"name"` Object string `json:"object"` TrialDays int `json:"trial_days"` Metadata map[string]string `json:"metadata"` // contains filtered or unexported fields }
PlanResponse はPlanService.はPlanService.Listで返されるプランを表す構造体です
func (*PlanResponse) UnmarshalJSON ¶
func (p *PlanResponse) UnmarshalJSON(b []byte) error
UnmarshalJSON はJSONパース用の内部APIです。
type PlanService ¶
type PlanService struct {
// contains filtered or unexported fields
}
PlanService は定期購入のときに使用する静的なプラン情報を扱います。
金額、支払い実行日(1-31)、トライアル日数などを指定して、 あなたのビジネスに必要なさまざまなプランを生成することができます。
生成したプランは、顧客と紐付けて定期購入処理を行うことができます。
func (PlanService) All ¶ added in v0.1.0
func (c PlanService) All(params ...*PlanListParams) ([]*PlanResponse, bool, error)
func (PlanService) Create ¶
func (p PlanService) Create(plan Plan) (*PlanResponse, error)
Create は金額や通貨などを指定して定期購入に利用するプランを生成します。
トライアル日数を指定することで、トライアル付きのプランを生成することができます。
また、支払いの実行日を指定すると、支払い日の固定されたプランを生成することができます。
func (PlanService) List ¶
func (p PlanService) List() *planListCaller
List は生成したプランのリストを取得します。リストは、直近で生成された順番に取得されます。
func (PlanService) Retrieve ¶
func (p PlanService) Retrieve(id string) (*PlanResponse, error)
Retrieve plan object. 特定のプラン情報を取得します。
func (PlanService) Update ¶
func (p PlanService) Update(id string, plan Plan) (*PlanResponse, error)
Update はプラン情報を更新します。
type Service ¶
type Service struct { Client *http.Client MaxCount int InitialDelay float64 MaxDelay float64 Logger LoggerInterface Charge *ChargeService Customer *CustomerService Plan *PlanService Subscription *SubscriptionService Token *TokenService Transfer *TransferService Statement *StatementService Term *TermService Balance *BalanceService Event *EventService Account *AccountService // contains filtered or unexported fields }
Service 構造体はPAY.JPのすべてのAPIの起点となる構造体です。 New()を使ってインスタンスを生成します。
type StatementItem ¶ added in v0.1.0
type StatementItem struct { Amount int `json:"amount"` Name string `json:"name"` Subject string `json:"subject"` TaxRate string `json:"tax_rate"` }
StatementItem
type StatementListParams ¶ added in v0.1.0
type StatementResponse ¶ added in v0.1.0
type StatementResponse struct { ID string `json:"id"` LiveMode bool `json:"livemode"` Object string `json:"object"` Title string `json:"title"` BalanceId string `json:"balance_id"` TenantId string `json:"tenant_id"` Type string `json:"type"` Net int64 `json:"net"` Term *TermResponse `json:"term"` CreatedAt time.Time UpdatedAt time.Time Items []StatementItem Created *int `json:"created"` Updated *int `json:"updated"` RawItems []json.RawMessage `json:"items"` // contains filtered or unexported fields }
StatementResponse
func (*StatementResponse) StatementUrls ¶ added in v0.1.0
func (s *StatementResponse) StatementUrls(p ...StatementUrls) (*StatementUrlResponse, error)
func (*StatementResponse) UnmarshalJSON ¶ added in v0.1.0
func (s *StatementResponse) UnmarshalJSON(b []byte) error
type StatementService ¶ added in v0.1.0
type StatementService struct {
// contains filtered or unexported fields
}
func (StatementService) All ¶ added in v0.1.0
func (c StatementService) All(params ...*StatementListParams) ([]*StatementResponse, bool, error)
func (StatementService) Retrieve ¶ added in v0.1.0
func (s StatementService) Retrieve(id string) (*StatementResponse, error)
Retrieve Statement object.
type StatementUrlResponse ¶ added in v0.1.0
type StatementUrlResponse struct { Expires int `json:"expires"` Object string `json:"object"` URL string `json:"url"` }
StatementUrlResponse
type StatementUrls ¶ added in v0.1.0
type StatementUrls struct {
Platformer *bool // プラットフォーム手数料に関する明細か否か
}
type Subscription ¶
type Subscription struct { TrialEnd interface{} // トライアルの終了時期 (time.Time or "now") TrialEndAt time.Time // deprecated SkipTrial interface{} // deprecated PlanID interface{} // プランID(string) NextCyclePlanID interface{} // 次サイクルから適用するプランID(string, 更新時のみ設定可能) Prorate interface{} // 日割り課金をするかどうか(bool) Metadata map[string]string // メタデータ }
Subscription はSubscribeやUpdateの引数を設定するのに使用する構造体です。
type SubscriptionDelete ¶ added in v0.1.0
type SubscriptionDelete struct {
Prorate *bool `form:"prorate"`
}
type SubscriptionListParams ¶ added in v0.1.0
type SubscriptionListParams struct { ListParams `form:"*"` Customer *string `form:"customer"` Plan *string `form:"plan"` Status *SubscriptionStatus `form:"status"` }
type SubscriptionResponse ¶
type SubscriptionResponse struct { CreatedAt time.Time // この定期課金作成時のタイムスタンプ Created *int `json:"created"` StartAt time.Time // この定期課金開始時のタイムスタンプ Start *int `json:"start"` CurrentPeriodStartAt time.Time // 現在の購読期間開始時のタイムスタンプ CurrentPeriodStart *int `json:"current_period_start"` CurrentPeriodEndAt time.Time // 現在の購読期間終了時のタイムスタンプ CurrentPeriodEnd *int `json:"current_period_end"` TrialStartAt time.Time // トライアル期間開始時のタイムスタンプ TrialStart *int `json:"trial_start"` TrialEndAt time.Time // トライアル期間終了時のタイムスタンプ TrialEnd *int `json:"trial_end"` PausedAt time.Time // 定期課金が停止状態になった時のタイムスタンプ RawPausedAt *int `json:"paused_at"` CanceledAt time.Time // 定期課金がキャンセル状態になった時のタイムスタンプ RawCanceledAt *int `json:"canceled_at"` ResumedAt time.Time // 停止またはキャンセル状態の定期課金が有効状態になった時のタイムスタンプ RawResumedAt *int `json:"resumed_at"` Customer string `json:"customer"` ID string `json:"id"` LiveMode bool `json:"livemode"` Object string `json:"object"` RawPlan json.RawMessage `json:"plan"` Plan Plan // この定期課金のプラン情報 NextCyclePlan *Plan `json:"next_cycle_plan"` Prorate bool `json:"prorate"` Status SubscriptionStatus `json:"status"` Metadata map[string]string `json:"metadata"` // contains filtered or unexported fields }
SubscriptionResponse はSubscriptionService.GetやSubscriptionService.Listで返される 定期購読情報持つ構造体です。
func (*SubscriptionResponse) Cancel ¶
func (s *SubscriptionResponse) Cancel() error
Cancel をSubscriptionResponseから実行します。
func (*SubscriptionResponse) Delete ¶
func (s *SubscriptionResponse) Delete(params ...SubscriptionDelete) error
Delete をSubscriptionResponseから実行します。
func (*SubscriptionResponse) Pause ¶
func (s *SubscriptionResponse) Pause() error
Pause をSubscriptionResponseから実行します。
func (*SubscriptionResponse) Resume ¶
func (s *SubscriptionResponse) Resume(subscription Subscription) error
Resume をSubscriptionResponseから実行します。
func (*SubscriptionResponse) UnmarshalJSON ¶
func (s *SubscriptionResponse) UnmarshalJSON(b []byte) error
UnmarshalJSON はJSONパース用の内部APIです。
func (*SubscriptionResponse) Update ¶
func (s *SubscriptionResponse) Update(subscription Subscription) error
Update をSubscriptionResponseから実行します。
type SubscriptionService ¶
type SubscriptionService struct {
// contains filtered or unexported fields
}
SubscriptionService は月単位で定期的な支払い処理を行うサービスです。顧客IDとプランIDを指定して生成します。
func (SubscriptionService) All ¶ added in v0.1.0
func (c SubscriptionService) All(params ...*SubscriptionListParams) ([]*SubscriptionResponse, bool, error)
func (SubscriptionService) Cancel ¶
func (s SubscriptionService) Cancel(subscriptionID string) (*SubscriptionResponse, error)
Cancel は定期課金をキャンセルし、現在の周期の終了日をもって定期課金を終了させます。
func (SubscriptionService) Delete ¶
func (s SubscriptionService) Delete(subscriptionID string, params ...SubscriptionDelete) error
func (SubscriptionService) List ¶
func (s SubscriptionService) List() *subscriptionListCaller
deprecated
func (SubscriptionService) Pause ¶
func (s SubscriptionService) Pause(subscriptionID string) (*SubscriptionResponse, error)
Pause は引き落としの失敗やカードが不正である、また定期課金を停止したい場合はこのリクエストで定期購入を停止させます。
定期課金を停止させると、再開されるまで引き落とし処理は一切行われません。
func (SubscriptionService) Resume ¶
func (s SubscriptionService) Resume(subscriptionID string, subscription Subscription) (*SubscriptionResponse, error)
Resume は停止もしくはキャンセル状態の定期課金を再開させます。
func (SubscriptionService) Retrieve ¶
func (s SubscriptionService) Retrieve(customerID, id string) (*SubscriptionResponse, error)
Retrieve subscription object. 特定の定期課金情報を取得します。
func (SubscriptionService) Subscribe ¶
func (s SubscriptionService) Subscribe(customerID string, subscription Subscription) (*SubscriptionResponse, error)
Subscribe は顧客IDとプランIDを指定して、定期課金を開始することができます。 TrialEndを指定することで、プラン情報を上書きするトライアル設定も可能です。 最初の支払いは定期課金作成時に実行されます。 支払い実行日(BillingDay)が指定されているプランの場合は日割り設定(Prorate)を有効化しない限り、 作成時よりもあとの支払い実行日に最初の課金が行われます。またトライアル設定がある場合は、 トライアル終了時に支払い処理が行われ、そこを基準にして定期課金が開始されます。
func (SubscriptionService) Update ¶
func (s SubscriptionService) Update(subscriptionID string, subscription Subscription) (*SubscriptionResponse, error)
Update はトライアル期間を新たに設定したり、プランの変更を行うことができます。
type SubscriptionStatus ¶
type SubscriptionStatus string
SubscriptionStatus は定期購読のステータスを表すEnumです。
func (SubscriptionStatus) String ¶ added in v0.1.0
func (s SubscriptionStatus) String() string
type TermListParams ¶ added in v0.2.0
type TermResponse ¶ added in v0.2.0
type TermResponse struct { ID string `json:"id"` LiveMode bool `json:"livemode"` Object string `json:"object"` ChargeCount int `json:"charge_count"` RefundCount int `json:"refund_count"` DisputeCount int `json:"dispute_count"` StartAt *int `json:"start_at"` EndAt *int `json:"end_at"` // contains filtered or unexported fields }
func (*TermResponse) UnmarshalJSON ¶ added in v0.2.0
func (s *TermResponse) UnmarshalJSON(b []byte) error
type TermService ¶ added in v0.2.0
type TermService struct {
// contains filtered or unexported fields
}
func (TermService) All ¶ added in v0.2.0
func (c TermService) All(params ...*TermListParams) ([]*TermResponse, bool, error)
func (TermService) Retrieve ¶ added in v0.2.0
func (s TermService) Retrieve(id string) (*TermResponse, error)
type Token ¶ added in v0.1.0
type Token struct { Card Number interface{} // カード番号 ExpMonth interface{} // 有効期限月 ExpYear interface{} // 有効期限年 CVC interface{} // CVCコード }
type TokenResponse ¶
type TokenResponse struct { CreatedAt time.Time // このトークン作成時間 RawCard json.RawMessage `json:"card"` Card CardResponse // クレジットカードの情報 Created *int `json:"created"` ID string `json:"id"` LiveMode bool `json:"livemode"` Object string `json:"object"` Used bool `json:"used"` // contains filtered or unexported fields }
TokenResponse はToken.Create(), Token.Retrieve()が返す構造体です。
func (*TokenResponse) UnmarshalJSON ¶
func (t *TokenResponse) UnmarshalJSON(b []byte) error
UnmarshalJSON はJSONパース用の内部APIです。
type TokenService ¶
type TokenService struct {
// contains filtered or unexported fields
}
TokenService はカード情報を代替するトークンオブジェクトを扱います。
func (TokenService) Create ¶
func (t TokenService) Create(card Token) (*TokenResponse, error)
Create はテストモードのみ利用可能で、トークンを生成します。
func (TokenService) Retrieve ¶
func (t TokenService) Retrieve(id string) (*TokenResponse, error)
Retrieve token object. 特定のトークン情報を取得します。
type TransferChargeListCaller ¶
type TransferChargeListCaller struct { TransferChargeListParams // contains filtered or unexported fields }
func (*TransferChargeListCaller) CustomerID ¶
func (c *TransferChargeListCaller) CustomerID(ID string) *TransferChargeListCaller
CustomerID はここに指定した顧客IDを持つデータを取得します
func (*TransferChargeListCaller) Do ¶
func (c *TransferChargeListCaller) Do() ([]*ChargeResponse, bool, error)
Do は指定されたクエリーを元に入金内訳のリストを配列で取得します。
func (*TransferChargeListCaller) Limit ¶
func (c *TransferChargeListCaller) Limit(limit int) *TransferChargeListCaller
Limit はリストの要素数の最大値を設定します(1-100)
func (*TransferChargeListCaller) Offset ¶
func (c *TransferChargeListCaller) Offset(offset int) *TransferChargeListCaller
Offset は取得するリストの先頭要素のインデックスのオフセットを設定します
func (*TransferChargeListCaller) Since ¶
func (c *TransferChargeListCaller) Since(since time.Time) *TransferChargeListCaller
Since はここに指定したタイムスタンプ以降に作成されたデータを取得します
func (*TransferChargeListCaller) Until ¶
func (c *TransferChargeListCaller) Until(until time.Time) *TransferChargeListCaller
Until はここに指定したタイムスタンプ以前に作成されたデータを取得します
type TransferChargeListParams ¶ added in v0.1.0
type TransferChargeListParams struct { ListParams `form:"*"` Customer *string `form:"customer"` }
TransferChargeListParams は入金内訳のリスト取得に使用する構造体です。
type TransferListParams ¶ added in v0.1.0
type TransferListParams struct { ListParams `form:"*"` SinceSheduledDate *int `form:"since_scheduled_date"` UntilSheduledDate *int `form:"until_scheduled_date"` Status *TransferStatus `form:"status"` }
type TransferResponse ¶
type TransferResponse struct { ID string `json:"id"` // tr_で始まる一意なオブジェクトを示す文字列 LiveMode bool `json:"livemode"` // 本番環境かどうか Created *int `json:"created"` // この入金作成時のタイムスタンプ CreatedAt time.Time // この入金作成時のタイムスタンプ Amount int `json:"amount"` // 入金予定額 CarriedBalance int // 繰越金 RawCarriedBalance *int `json:"carried_balance"` Currency string `json:"currency"` // 3文字のISOコード(現状 “jpy” のみサポート) Status TransferStatus `json:"status"` // この入金の処理状態 Charges []*ChargeResponse // この入金に含まれる支払いのリスト RawCharges listResponseParser `json:"charges"` ScheduledDate string `json:"scheduled_date"` // 入金予定日 Summary struct { ChargeCount int `json:"charge_count"` // 支払い総数 ChargeFee int `json:"charge_fee"` // 支払い手数料 ChargeGross int `json:"charge_gross"` // 総売上 Net int `json:"net"` // 差引額 RefundAmount int `json:"refund_amount"` // 返金総額 RefundCount int `json:"refund_count"` // 返金総数 DisputeAmount int `json:"dispute_amount"` // チャージバックにより相殺された金額の合計 DisputeCount int `json:"dispute_count"` // チャージバック対象となったchargeの個数 } `json:"summary"` Description string // 概要 RawDescription *string `json:"description"` TermStartAt time.Time // 集計期間開始時のタイムスタンプ TermEndAt time.Time // 集計期間終了時のタイムスタンプ TermEnd *int `json:"term_end"` TermStart *int `json:"term_start"` TransferAmount int TransferDate string RawTransferAmount *int `json:"transfer_amount"` RawTransferDate *string `json:"transfer_date"` Object string `json:"object"` // contains filtered or unexported fields }
TransferResponse はTransferService.Get、TransferService.Listによって返される、 入金状態を示す構造体です。
func (*TransferResponse) All ¶ added in v0.1.0
func (c *TransferResponse) All(params ...*TransferChargeListParams) ([]*ChargeResponse, bool, error)
func (*TransferResponse) UnmarshalJSON ¶
func (t *TransferResponse) UnmarshalJSON(b []byte) error
type TransferService ¶
type TransferService struct {
// contains filtered or unexported fields
}
TransferService は入金に関するサービスです。
func (TransferService) All ¶ added in v0.1.0
func (c TransferService) All(params ...*TransferListParams) ([]*TransferResponse, bool, error)
func (TransferService) ChargeList ¶
func (t TransferService) ChargeList(id string) *TransferChargeListCaller
ChargeList は支払いは入金内訳リストを取得します。リストは、直近で生成された順番に取得されます。
func (TransferService) Retrieve ¶
func (t TransferService) Retrieve(transferID string) (*TransferResponse, error)
Retrieve transfer object. 入金情報を取得します。