Categorygithub.com/getopenpay/getopenpay-go
repositorypackage
0.0.0-20241123055028-47db43273d90
Repository: https://github.com/getopenpay/getopenpay-go.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

Quick start

  1. Go into sanity_test.go and replace TODO_ADD_BEARER_KEY with your secret token

go build

go test -v

Go API client for getopenpay

super charge your subscription management.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 1.0.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import getopenpay "github.com/getopenpay/getopenpay-go"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value getopenpay.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), getopenpay.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value getopenpay.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), getopenpay.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using getopenpay.ContextOperationServerIndices and getopenpay.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), getopenpay.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), getopenpay.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://connto.getopenpay.com

ClassMethodHTTP requestDescription
BillingPortalAPICreatePortalSessionPost /billing_portal/sessionsCreate Portal Session
ChargesAPIGetChargeGet /charges/{charge_id}Get Charge
ChargesAPIListChargesPost /charges/listList Charges
ChargesAPISearchChargesPost /charges/searchSearch Charges
ChargesAPIUpdateChargePut /charges/{charge_id}Update Charge
CheckoutAPICreateCheckoutSessionPost /checkout/sessionsCreate Checkout Session
CheckoutAPIGetCheckoutSessionGet /checkout/sessions/{session_id}Get Checkout Session
CheckoutAPIListCheckoutSessionsPost /checkout/listList Checkout Sessions
CouponsAPICreateCouponPost /coupons/Create Coupon
CouponsAPIDeleteCouponDelete /coupons/{coupon_id}Delete Coupon
CouponsAPIGetCouponGet /coupons/{coupon_id}Get Coupon
CouponsAPIListCouponsPost /coupons/listList Coupons
CouponsAPIUpdateCouponPut /coupons/{coupon_id}Update Coupon
CreditNotesAPICreateCreditNotePost /credit-notes/Create Credit Note
CreditNotesAPIGetCreditNoteGet /credit-notes/{credit_note_id}Get Credit Note
CreditNotesAPIListCreditNotesPost /credit-notes/listList Credit Notes
CustomersAPICreateCustomerPost /customers/Create Customer
CustomersAPICreateCustomerBalanceTransactionPost /customers/{customer_id}/balance-transactionsCreate Customer Balance Transaction
CustomersAPIDeleteCustomerDiscountDelete /customers/{customer_id}/discountDelete Customer Discount
CustomersAPIGetCustomerGet /customers/{customer_id}Get Customer
CustomersAPIGetCustomerBalanceTransactionGet /customers/{customer_id}/balance-transactions/{transaction_id}Get Customer Balance Transaction
CustomersAPIGetCustomerBalanceTransactionsGet /customers/{customer_id}/balance-transactionsGet Customer Balance Transactions
CustomersAPIListCustomerPaymentMethodsPost /customers/{customer_id}/payment-methodsList Customer Payment Methods
CustomersAPIListCustomersPost /customers/listList Customers
CustomersAPIListValidSubscriptionsPost /customers/{customer_id}/list_valid_subscriptionsList Valid Subscriptions
CustomersAPISearchCustomersPost /customers/searchSearch Customers
CustomersAPIUpdateCustomerPut /customers/{customer_external_id}Update Customer
DisputesAPICreateDisputePost /dispute/Create Dispute
DisputesAPIGetDisputeGet /dispute/{dispute_id}Get Dispute
EventsAPIGetEventGet /events/{event_id}Get Event
EventsAPIListEventsPost /events/listList Events
EventsAPISearchEventsPost /events/searchSearch Events
InvoiceItemsAPIDeleteInvoiceItemByIdDelete /invoice-items/{invoice_item_id}Delete Invoice Item By Id
InvoiceItemsAPIGetInvoiceItemGet /invoice-items/{invoice_item_id}Get Invoice Item
InvoiceItemsAPIListInvoiceItemsPost /invoice-items/listList Invoice Items
InvoicesAPIAddCommentPost /invoices/{invoice_external_id}/commentAdd Comment
InvoicesAPICreateInvoicePost /invoices/Create Invoice
InvoicesAPIFinalizeInvoicePost /invoices/{invoice_external_id}/finalizeFinalize Invoice
InvoicesAPIGetInvoiceGet /invoices/{invoice_external_id}Get Invoice
InvoicesAPIGetInvoicePublicGet /invoices/public/{public_permanent_token}Get Invoice Public
InvoicesAPIListInvoicesPost /invoices/listList Invoices
InvoicesAPIMarkInvoiceAsUncollectiblePost /invoices/{invoice_external_id}/mark_uncollectibleMark Invoice As Uncollectible
InvoicesAPIMarkInvoiceAsVoidPost /invoices/{invoice_external_id}/voidMark Invoice As Void
InvoicesAPIPayInvoicePost /invoices/{invoice_external_id}/payPay Invoice
InvoicesAPIPreviewNextInvoiceGet /invoices/preview_next_invoice/{subscription_id}Preview Next Invoice
InvoicesAPISearchInvoicesPost /invoices/searchSearch Invoices
InvoicesAPIUpdateInvoicePut /invoices/{invoice_id}Update Invoice
PaymentIntentsAPIGetPaymentIntentGet /payment-intents/{payment_intent_id}Get Payment Intent
PaymentIntentsAPIListPaymentIntentsPost /payment-intents/listList Payment Intents
PaymentIntentsAPISearchPaymentIntentsPost /payment-intents/searchSearch Payment Intents
PaymentIntentsAPIUpdatePaymentIntentPut /payment-intents/{payment_intent_id}Update Payment Intent
PaymentLinksAPICreatePaymentLinkPost /payment-link/Create Payment Link
PaymentLinksAPIGetPaymentLinkGet /payment-link/{plink_id}Get Payment Link
PaymentLinksAPIListPaymentLinksPost /payment-link/listList Payment Links
PaymentLinksAPIOpenPaymentLinkPagePublicGet /payment-link/public/{secure_token}Open Payment Link Page Public
PaymentMethodsAPIAttachPaymentMethodPost /payment-methods/{payment_method_id}/attachAttach Payment Method
PaymentMethodsAPIAuthorizePaymentMethodPost /payment-methods/authorizeAuthorize Payment Method
PaymentMethodsAPIDetachPaymentMethodPost /payment-methods/{payment_method_id}/detachDetach Payment Method
PaymentMethodsAPIGetPaymentMethodGet /payment-methods/{payment_method_id}Get Payment Method
PricesAPICreatePriceForProductPost /prices/Create Price For Product
PricesAPIDeletePriceForProductDelete /prices/{price_id}Delete Price For Product
PricesAPIGetPriceAddOnsGet /prices/{price_id}/add-onsGet Price Add Ons
PricesAPIGetPriceForProductGet /prices/{price_id}Get Price For Product
PricesAPIListPricesPost /prices/listList Prices
PricesAPISearchPricesPost /prices/searchSearch Prices
PricesAPIUpdatePriceForProductPut /prices/{price_id}Update Price For Product
ProductFamilyAPICreateProductFamilyPost /product-family/Create Product Family
ProductFamilyAPIDeleteProductFamilyDelete /product-family/{id}Delete Product Family
ProductFamilyAPIGetProductFamilyGet /product-family/{id}Get Product Family
ProductFamilyAPIListProductFamiliesPost /product-family/listList Product Families
ProductFamilyAPIUpdateProductFamilyPut /product-family/{id}Update Product Family
ProductsAPICreateProductPost /products/Create Product
ProductsAPIDeleteProductDelete /products/{product_id}Delete Product
ProductsAPIGetProductGet /products/{product_id}Get Product
ProductsAPIListProductsPost /products/listList Products
ProductsAPISearchProductsPost /products/searchSearch Products
ProductsAPIUpdateProductPut /products/{product_id}Update Product
PromotionCodesAPICreatePromoCodePost /promotion-codes/Create Promo Code
PromotionCodesAPIGetPromoCodeGet /promotion-codes/{promo_code_id}Get Promo Code
PromotionCodesAPIGetPromoCodeByCodeGet /promotion-codes/code/{promo_code}Get Promo Code By Code
PromotionCodesAPIListPromoCodesPost /promotion-codes/listList Promo Codes
PromotionCodesAPIUpdatePromoCodePut /promotion-codes/{promo_code_id}Update Promo Code
RefundsAPICreateRefundPost /refunds/Create Refund
RefundsAPIListRefundsPost /refunds/listList Refunds
SubscriptionItemsAPICreateSubscriptionItemPost /subscription-items/Create Subscription Item
SubscriptionItemsAPIDeleteSubscriptionItemDelete /subscription-items/{subscription_item_id}Delete Subscription Item
SubscriptionItemsAPIGetSubscriptionItemGet /subscription-items/{subscription_item_id}Get Subscription Item
SubscriptionItemsAPIListSubscriptionItemsPost /subscription-items/listList Subscription Items
SubscriptionItemsAPIUpdateSubscriptionItemPut /subscription-items/{subscription_item_id}Update Subscription Item
SubscriptionsAPICancelSubscriptionTrialPost /subscriptions/{subscription_id}/cancel-subscription-trialCancel Subscription Trial
SubscriptionsAPICreateSubscriptionsPost /subscriptions/Create Subscriptions
SubscriptionsAPIDeleteSubscriptionDelete /subscriptions/{subscription_id}Delete Subscription
SubscriptionsAPIDeleteSubscriptionDiscountDelete /subscriptions/{subscription_id}/discountDelete Subscription Discount
SubscriptionsAPIGetSubscriptionGet /subscriptions/{subscription_id}Get Subscription
SubscriptionsAPIListSubscriptionsPost /subscriptions/listList Subscriptions
SubscriptionsAPIPauseSubscriptionPut /subscriptions/{subscription_id}/pausePause Subscription
SubscriptionsAPIRefreshSubscriptionStatusPost /subscriptions/{subscription_id}/refresh-statusRefresh Subscription Status
SubscriptionsAPIResumeSubscriptionPut /subscriptions/{subscription_id}/resumeResume Subscription
SubscriptionsAPISearchSubscriptionsPost /subscriptions/searchSearch Subscriptions
SubscriptionsAPIUpdateSubscriptionPut /subscriptions/{subscription_id}Update Subscription
TaxIntegrationsAPICreateTaxIntegrationPost /integrations/tax/Create Tax Integration

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

HTTPBearer

  • Type: HTTP Bearer token authentication

Example

auth := context.WithValue(context.Background(), getopenpay.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author