super charge your subscription management.
- In
sanity_test.goand replaceTODO_SECRET_KEYwith your OpenPay secret token
In staging your secret token would start with st_stg_* and in prod st_prod_*
-
go build -
go test -v
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.2.1
- Package version: 1.0.0
- Generator version: 7.11.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/net/contextPut 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")Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.
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 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.
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",
},
})All URIs are relative to https://connto.getopenpay.com
| Class | Method | HTTP request | Description |
|---|---|---|---|
| BillingMeterEventAdjustmentsAPI | CreateBillingMeterEventAdjustments | Post /billing/meter-event-adjustments/ | Create Billing Meter Event Adjustments |
| BillingMeterEventsAPI | CreateBillingMeterEvent | Post /billing/meter-events/ | Create Billing Meter Event |
| BillingMeterEventsAPI | ListBillingMeterEventSummaries | Post /billing/meter-events/list | List Billing Meter Event Summaries |
| BillingMetersAPI | CreateBillingMeter | Post /billing/meters/ | Create Billing Meter |
| BillingMetersAPI | DeactivateBillingMeter | Post /billing/meters/{meter_id}/deactivate | Deactivate Billing Meter |
| BillingMetersAPI | GetBillingMeter | Get /billing/meters/{meter_id} | Get Billing Meter |
| BillingMetersAPI | ListBillingMeters | Post /billing/meters/list | List Billing Meters |
| BillingMetersAPI | ReactivateBillingMeter | Post /billing/meters/{meter_id}/reactivate | Reactivate Billing Meter |
| BillingPortalAPI | CreatePortalSession | Post /billing_portal/sessions | Create Portal Session |
| ChargesAPI | GetCharge | Get /charges/{charge_id} | Get Charge |
| ChargesAPI | ListCharges | Post /charges/list | List Charges |
| ChargesAPI | UpdateCharge | Put /charges/{charge_id} | Update Charge |
| CheckoutAPI | CreateCheckoutSession | Post /checkout/sessions | Create Checkout Session |
| CheckoutAPI | GetCheckoutSession | Get /checkout/sessions/{session_id} | Get Checkout Session |
| CheckoutAPI | ListCheckoutSessions | Post /checkout/list | List Checkout Sessions |
| CheckoutAPI | ValidateCheckoutAttempt | Get /checkout/checkout_attempts/validate/{checkout_attempt_id} | Validate Checkout Attempt |
| CheckoutAPI | VerifyCheckoutSessionPaymentMethod | Get /checkout/sessions/{checkout_secure_token}/verify_payment_method/{payment_method_id} | Verify Checkout Session Payment Method |
| CouponsAPI | CreateCoupon | Post /coupons/ | Create Coupon |
| CouponsAPI | DeleteCoupon | Delete /coupons/{coupon_id} | Delete Coupon |
| CouponsAPI | GetCoupon | Get /coupons/{coupon_id} | Get Coupon |
| CouponsAPI | ListCoupons | Post /coupons/list | List Coupons |
| CouponsAPI | UpdateCoupon | Put /coupons/{coupon_id} | Update Coupon |
| CreditNotesAPI | CreateCreditNote | Post /credit-notes/ | Create Credit Note |
| CreditNotesAPI | GetCreditNote | Get /credit-notes/{credit_note_id} | Get Credit Note |
| CreditNotesAPI | ListCreditNotes | Post /credit-notes/list | List Credit Notes |
| CustomersAPI | CreateCustomer | Post /customers/ | Create Customer |
| CustomersAPI | CreateCustomerBalanceTransaction | Post /customers/{customer_id}/balance-transactions | Create Customer Balance Transaction |
| CustomersAPI | DeleteCustomerDiscount | Delete /customers/{customer_id}/discount | Delete Customer Discount |
| CustomersAPI | GetCustomer | Get /customers/{customer_id} | Get Customer |
| CustomersAPI | GetCustomerBalanceTransaction | Get /customers/{customer_id}/balance-transactions/{transaction_id} | Get Customer Balance Transaction |
| CustomersAPI | GetCustomerBalanceTransactions | Get /customers/{customer_id}/balance-transactions | Get Customer Balance Transactions |
| CustomersAPI | ListCustomerPaymentMethods | Post /customers/{customer_id}/payment-methods | List Customer Payment Methods |
| CustomersAPI | ListCustomers | Post /customers/list | List Customers |
| CustomersAPI | ListValidSubscriptions | Post /customers/{customer_id}/list_valid_subscriptions | List Valid Subscriptions |
| CustomersAPI | UpdateCustomer | Put /customers/{customer_external_id} | Update Customer |
| DisputesAPI | CreateDispute | Post /dispute/ | Create Dispute |
| DisputesAPI | GetDispute | Get /dispute/{dispute_id} | Get Dispute |
| EventsAPI | GetEvent | Get /events/{event_id} | Get Event |
| EventsAPI | ListEvents | Post /events/list | List Events |
| EventsAPI | SearchEvents | Post /events/search | Search Events |
| EventsAPI | TriggerEventCallback | Post /events/trigger-webhook | Trigger Event Callback |
| InvoiceItemsAPI | DeleteInvoiceItemById | Delete /invoice-items/{invoice_item_id} | Delete Invoice Item By Id |
| InvoiceItemsAPI | GetInvoiceItem | Get /invoice-items/{invoice_item_id} | Get Invoice Item |
| InvoiceItemsAPI | ListInvoiceItems | Post /invoice-items/list | List Invoice Items |
| InvoicesAPI | AddComment | Post /invoices/{invoice_external_id}/comment | Add Comment |
| InvoicesAPI | CreateInvoice | Post /invoices/ | Create Invoice |
| InvoicesAPI | FinalizeInvoice | Post /invoices/{invoice_external_id}/finalize | Finalize Invoice |
| InvoicesAPI | GetInvoice | Get /invoices/{invoice_external_id} | Get Invoice |
| InvoicesAPI | GetInvoicePublic | Get /invoices/public/{public_permanent_token} | Get Invoice Public |
| InvoicesAPI | ListInvoices | Post /invoices/list | List Invoices |
| InvoicesAPI | MarkInvoiceAsUncollectible | Post /invoices/{invoice_external_id}/mark_uncollectible | Mark Invoice As Uncollectible |
| InvoicesAPI | MarkInvoiceAsVoid | Post /invoices/{invoice_external_id}/void | Mark Invoice As Void |
| InvoicesAPI | PayInvoice | Post /invoices/{invoice_external_id}/pay | Pay Invoice |
| InvoicesAPI | PreviewNextInvoice | Get /invoices/preview_next_invoice/{subscription_id} | Preview Next Invoice |
| InvoicesAPI | UpdateInvoice | Put /invoices/{invoice_id} | Update Invoice |
| PaymentIntentsAPI | GetPaymentIntent | Get /payment-intents/{payment_intent_id} | Get Payment Intent |
| PaymentIntentsAPI | ListPaymentIntents | Post /payment-intents/list | List Payment Intents |
| PaymentIntentsAPI | UpdatePaymentIntent | Put /payment-intents/{payment_intent_id} | Update Payment Intent |
| PaymentLinksAPI | CreatePaymentLink | Post /payment-link/ | Create Payment Link |
| PaymentLinksAPI | GetPaymentLink | Get /payment-link/{plink_id} | Get Payment Link |
| PaymentLinksAPI | ListPaymentLinks | Post /payment-link/list | List Payment Links |
| PaymentLinksAPI | OpenPaymentLinkPagePublic | Get /payment-link/public/{secure_token} | Open Payment Link Page Public |
| PaymentMethodsAPI | AttachPaymentMethod | Post /payment-methods/{payment_method_id}/attach | Attach Payment Method |
| PaymentMethodsAPI | AuthorizePaymentMethod | Post /payment-methods/authorize | Authorize Payment Method |
| PaymentMethodsAPI | DetachPaymentMethod | Post /payment-methods/{payment_method_id}/detach | Detach Payment Method |
| PaymentMethodsAPI | GetPaymentMethod | Get /payment-methods/{payment_method_id} | Get Payment Method |
| PaymentRoutesAPI | CreatePaymentRoute | Post /payment-routes/ | Create Payment Route |
| PaymentRoutesAPI | DeletePaymentRoute | Delete /payment-routes/{payment_route_id} | Delete Payment Route |
| PaymentRoutesAPI | GetPaymentRoute | Get /payment-routes/{payment_route_id} | Get Payment Route |
| PaymentRoutesAPI | ListPaymentRoutes | Post /payment-routes/list | List Payment Routes |
| PaymentRoutesAPI | UpdatePaymentRoute | Put /payment-routes/{payment_route_id} | Update Payment Route |
| PricesAPI | CreatePriceForProduct | Post /prices/ | Create Price For Product |
| PricesAPI | DeletePriceForProduct | Delete /prices/{price_id} | Delete Price For Product |
| PricesAPI | FindPriceByAmount | Get /prices/find-by-amount/{amount} | Find Price By Amount |
| PricesAPI | GetPriceAddOns | Get /prices/{price_id}/add-ons | Get Price Add Ons |
| PricesAPI | GetPriceForProduct | Get /prices/{price_id} | Get Price For Product |
| PricesAPI | ListPrices | Post /prices/list | List Prices |
| PricesAPI | UpdatePriceForProduct | Put /prices/{price_id} | Update Price For Product |
| ProductFamilyAPI | CreateProductFamily | Post /product-family/ | Create Product Family |
| ProductFamilyAPI | DeleteProductFamily | Delete /product-family/{id} | Delete Product Family |
| ProductFamilyAPI | GetProductFamily | Get /product-family/{id} | Get Product Family |
| ProductFamilyAPI | ListProductFamilies | Post /product-family/list | List Product Families |
| ProductFamilyAPI | UpdateProductFamily | Put /product-family/{id} | Update Product Family |
| ProductsAPI | CreateProduct | Post /products/ | Create Product |
| ProductsAPI | DeleteProduct | Delete /products/{product_id} | Delete Product |
| ProductsAPI | GetProduct | Get /products/{product_id} | Get Product |
| ProductsAPI | ListProducts | Post /products/list | List Products |
| ProductsAPI | UpdateProduct | Put /products/{product_id} | Update Product |
| PromotionCodesAPI | CreatePromoCode | Post /promotion-codes/ | Create Promo Code |
| PromotionCodesAPI | GetPromoCode | Get /promotion-codes/{promo_code_id} | Get Promo Code |
| PromotionCodesAPI | GetPromoCodeByCode | Get /promotion-codes/code/{promo_code} | Get Promo Code By Code |
| PromotionCodesAPI | ListPromoCodes | Post /promotion-codes/list | List Promo Codes |
| PromotionCodesAPI | UpdatePromoCode | Put /promotion-codes/{promo_code_id} | Update Promo Code |
| RefundsAPI | CreateRefund | Post /refunds/ | Create Refund |
| RefundsAPI | ListRefunds | Post /refunds/list | List Refunds |
| SignupAnswersAPI | SignupQuestionnaireStatus | Get /signup-answers/ | Signup Questionnaire Status |
| SubscriptionItemsAPI | CreateSubscriptionItem | Post /subscription-items/ | Create Subscription Item |
| SubscriptionItemsAPI | DeleteSubscriptionItem | Delete /subscription-items/{subscription_item_id} | Delete Subscription Item |
| SubscriptionItemsAPI | GetSubscriptionItem | Get /subscription-items/{subscription_item_id} | Get Subscription Item |
| SubscriptionItemsAPI | ListSubscriptionItems | Post /subscription-items/list | List Subscription Items |
| SubscriptionItemsAPI | UpdateSubscriptionItem | Put /subscription-items/{subscription_item_id} | Update Subscription Item |
| SubscriptionsAPI | CancelSubscriptionTrial | Post /subscriptions/{subscription_id}/cancel-subscription-trial | Cancel Subscription Trial |
| SubscriptionsAPI | CreateSubscriptions | Post /subscriptions/ | Create Subscriptions |
| SubscriptionsAPI | DeleteSubscription | Delete /subscriptions/{subscription_id} | Delete Subscription |
| SubscriptionsAPI | DeleteSubscriptionDiscount | Delete /subscriptions/{subscription_id}/discount | Delete Subscription Discount |
| SubscriptionsAPI | GetSubscription | Get /subscriptions/{subscription_id} | Get Subscription |
| SubscriptionsAPI | ListSubscriptions | Post /subscriptions/list | List Subscriptions |
| SubscriptionsAPI | PauseSubscription | Put /subscriptions/{subscription_id}/pause | Pause Subscription |
| SubscriptionsAPI | RefreshSubscriptionStatus | Post /subscriptions/{subscription_id}/refresh-status | Refresh Subscription Status |
| SubscriptionsAPI | ResumeSubscription | Put /subscriptions/{subscription_id}/resume | Resume Subscription |
| SubscriptionsAPI | UpdateSubscription | Put /subscriptions/{subscription_id} | Update Subscription |
| TaxIntegrationsAPI | CreateTaxIntegration | Post /integrations/tax/ | Create Tax Integration |
- ActiveSubResponse
- AddCommentRequest
- AttachPaymentMethodRequest
- AuthorizePaymentMethodRequest
- BillingMeterAdjustmentType
- BillingMeterAggregationFormula
- BillingMeterEventAdjustmentExternal
- BillingMeterEventAdjustmentStatus
- BillingMeterEventExternal
- BillingMeterEventStatus
- BillingMeterExternal
- BillingMeterQueryParams
- BillingMeterSummary
- BillingReasonEnum
- BillingSchemeEnum
- BooleanConfigField
- CalendarIntervalEnum
- ChargeExternal
- ChargeQueryParams
- ChargeStatusEnum
- CheckoutMode
- CheckoutPreferences
- CheckoutPreferencesOutput
- CheckoutProcessorsPreferences
- CheckoutSessionExternal
- CheckoutSessionLineItemExternal
- CheckoutSessionQueryParams
- CheckoutSessionStatus
- CheckoutSuccessResponse
- CollectionMethodEnum
- CompleteAddress
- CouponDuration
- CouponExternal
- CouponQueryParams
- CreateBillingMeterEventAdjustmentRequest
- CreateBillingMeterEventRequest
- CreateBillingMeterRequest
- CreateCheckoutLineItem
- CreateCheckoutSessionRequest
- CreateCouponRequest
- CreateCreditNoteLine
- CreateCreditNoteRequest
- CreateCustomerBalanceTransactionRequest
- CreateCustomerRequest
- CreateDisputeRequest
- CreateInvoiceRequest
- CreatePaymentLinkRequest
- CreatePaymentRouteRequest
- CreatePortalSessionRequest
- CreatePriceRequest
- CreateProductFamilyRequest
- CreateProductRequest
- CreatePromoCodeRequest
- CreateRefundRequest
- CreateSubscriptionItemRequest
- CreateSubscriptionRequest
- CreateSubscriptionResponse
- CreateTaxIntegrationRequest
- CreditNoteExternal
- CreditNoteItemExternal
- CreditNoteLineType
- CreditNoteQueryParams
- CreditNoteReason
- CurrencyEnum
- CustomerBalanceExternal
- CustomerBalanceTransactionExternal
- CustomerBalanceTransactionType
- CustomerExternal
- CustomerInvoiceSettings
- CustomerLanguage
- CustomerPaymentMethodQueryParams
- CustomerQueryParams
- CustomerStatus
- CustomerTotalAmount
- DateTimeFilter
- DeleteInvoiceItemResponse
- DeletePaymentRouteResponse
- DeletePriceResponse
- DeleteProductResponse
- DeleteSubscriptionItemRequest
- DeleteSubscriptionItemResponse
- DeleteSubscriptionRequest
- DeleteSubscriptionResponse
- DiscountExternal
- DisputeExternal
- EnumConfigField
- EventExternal
- EventRetriggerRequest
- EventRetriggerResponse
- EventSearchParams
- EventType
- EventsQueryParams
- FallbackConfigurationInput
- FallbackConfigurationOutput
- HTTPValidationError
- InlineSubscriptionItemUpdate
- IntRangeFilter
- InvoiceComment
- InvoiceDiscountAmountsExternal
- InvoiceExternal
- InvoiceItemDetails
- InvoiceItemDiscountAmountsExternal
- InvoiceItemDiscountAmountsPublic
- InvoiceItemExternal
- InvoiceItemPublic
- InvoiceItemsQueryParams
- InvoicePublic
- InvoiceQueryParams
- InvoiceSettings
- InvoiceStatusEnum
- InvoiceType
- ListActiveSubParams
- ListBillingMeterEventSummariesRequest
- ListResponseBillingMeterExternal
- ListResponseBillingMeterSummary
- ListResponseChargeExternal
- ListResponseCheckoutSessionExternal
- ListResponseCouponExternal
- ListResponseCreditNoteExternal
- ListResponseCustomerExternal
- ListResponseEventExternal
- ListResponseInvoiceExternal
- ListResponseInvoiceItemExternal
- ListResponsePaymentIntentExternal
- ListResponsePaymentLinkExternal
- ListResponsePaymentRouteExternal
- ListResponsePriceExternal
- ListResponseProductExternal
- ListResponseProductFamilyExternal
- ListResponsePromotionCodeExternal
- ListResponseRefundExternal
- ListResponseSubscriptionExternal
- ListResponseSubscriptionItemExternal
- ListResponseUnionTokenizedCreditCardExternalPaymentMethodExternal
- ListResponseUnionTokenizedCreditCardExternalPaymentMethodExternalDataInner
- MarkUncollectibleRequest
- MarkVoidRequest
- MerchantTaxIdSetting
- MeterEventValueGroupingWindow
- NonPciIntegration
- NonPciIntegrationConfigurationInner
- NonPciIntegrationEnum
- NumberConfigField
- ObjectName
- PayInvoiceRequest
- PaymentIntentExternal
- PaymentIntentQueryParams
- PaymentIntentStatus
- PaymentLinkExternal
- PaymentLinkLineItemExternal
- PaymentLinkQueryParams
- PaymentMethodExternal
- PaymentMethodMappingExternal
- PaymentProcessorName
- PaymentProviderType
- PaymentRouteExternal
- PaymentRouteType
- PortalSessionExternal
- PriceExternal
- PriceQueryParams
- PriceTierExternal
- PriceTierParams
- PriceTierPublic
- PriceTypeEnum
- PricingModel
- PricingTiersEnum
- ProductExternal
- ProductFamilyExternal
- ProductFamilyQueryParams
- ProductQueryParams
- PromoCodeQueryParams
- PromoRestrictions
- PromotionCodeExternal
- ProrationEnum
- RecurringDetails
- RefundExternal
- RefundQueryParams
- RefundReasonEnum
- RefundStatusEnum
- ResponseGetPaymentMethodPaymentMethodsPaymentMethodIdGet
- ResumeSubscriptionResponse
- SearchFilter
- SelectedPriceQuantity
- SetupIntentExternal
- SignupQuestionnaireStatus
- StringConfigField
- SubscriptionCancelFeedbackEnum
- SubscriptionCancellationDetails
- SubscriptionExternal
- SubscriptionItemDetails
- SubscriptionItemExternal
- SubscriptionItemQueryParams
- SubscriptionPauseRequest
- SubscriptionQueryParams
- SubscriptionResumeRequest
- SubscriptionStatusEnum
- TaxIdSetting
- TaxIdType
- TaxIdTypeEnum
- TaxIntegrationApiName
- TaxIntegrationExternal
- TokenizedCreditCardExternal
- UpdateChargeRequest
- UpdateCouponRequest
- UpdateCustomerRequest
- UpdateInvoiceRequest
- UpdatePaymentIntent
- UpdatePaymentRouteRequest
- UpdatePriceRequest
- UpdateProductFamilyRequest
- UpdateProductRequest
- UpdatePromoCodeRequest
- UpdateSubscriptionItemRequest
- UpdateSubscriptionRequest
- UpdateSubscriptionResponse
- UsageAggMethodEnum
- UsageTypeEnum
- ValidationError
- ValidationErrorLocInner
- WebhookDeliveryResult
Authentication schemes defined for the API:
- Type: HTTP Bearer token authentication
Example
auth := context.WithValue(context.Background(), getopenpay.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)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:
PtrBoolPtrIntPtrInt32PtrInt64PtrFloatPtrFloat32PtrFloat64PtrStringPtrTime