GitHub가 새 탭에서 열립니다. 로그인한 다음 repository를 소유한 organization 또는 사용자 계정에 Dodo Payments GitHub App을 설치합니다. App에 All repositories 또는 Only select repositories에 대한 액세스 권한을 부여할 수 있습니다. repository를 선택하는 경우 액세스를 제한할 모든 repository를 포함해야 합니다.
GitHub Install & Authorize page. Choose which repositories the app can manage.
GitHub가 다시 리디렉션하면 계정이 연결되었음을 보여 주는 확인 페이지가 표시됩니다.
Account connected. Return to the Dodo Payments dashboard to continue.
3
Pick a Repository and Permission
Dashboard로 돌아와 entitlement가 액세스 권한을 부여할 Repository를 선택한 다음 Permission 수준을 선택합니다. repository 선택기에는 GitHub App이 액세스할 수 있는 repository만 표시됩니다. entitlement의 Name을 입력하고 Create Entitlement를 클릭합니다.
Creating a GitHub entitlement. Pick the repository and the permission you want customers to receive.
4
Attach It to a Product
entitlement를 원하는 제품에 연결합니다. 해당 제품을 구매한 고객은 GitHub 계정을 연결한 후 GitHub 초대를 받습니다.
Dodo Payments가 Pending 상태로 grant를 생성합니다. Dodo Payments는 즉시 GitHub authorization URL을 생성하려고 시도하고 이를 oauth_url에 저장합니다. 이 작업이 실패하면 고객이 accept flow를 시작할 때까지 oauth_url는 null 상태로 유지됩니다.
결제 확인 이메일에는 entitlement가 Action Required로 표시되고 Customer Portal 링크가 포함됩니다. 포털에서 고객은 Connect를 클릭하고 GitHub로 authorize합니다. authorization link는 30분 후 만료되며, 고객이 다시 방문하면 Customer Portal에서 새 링크를 생성합니다.
// client is a *dodopayments.Client, for example from// dodopayments.NewClient(option.WithEnvironmentTestMode()); ctx is a context.Context.client.Entitlements.New(ctx, dodopayments.EntitlementNewParams{ Name: dodopayments.F("Code Share Repository"), IntegrationType: dodopayments.F(dodopayments.EntitlementIntegrationTypeGitHub), IntegrationConfig: dodopayments.F[dodopayments.IntegrationConfigUnionParam]( dodopayments.IntegrationConfigGitHubConfigParam{ TargetID: dodopayments.F("acme/private-sdk"), Permission: dodopayments.F(dodopayments.GitHubPermissionPull), }, ),})
entitlement_grant.created가 status: "Pending"와 함께 발생합니다. oauth_url에 이미 GitHub authorization URL이 저장되어 있을 수 있습니다. 값이 null인 경우 고객이 Customer Portal에서 accept flow를 시작하면 값이 설정됩니다.
access가 철회되면 entitlement_grant.revoked가 발생합니다. GitHub App을 uninstall하면 Dodo Payments가 revocation_reason: platform_external를 사용하여 해당 installation의 pending 및 delivered grant를 revoke합니다.
Dodo Payments가 repository에 고객을 추가할 수 없을 때(예: GitHub App이 repository에 대한 access를 잃은 경우) entitlement_grant.failed가 error_code: "GRANT_ACCESS_FAILED"와 함께 발생합니다.
Dodo Payments GitHub App은 repository를 소유한 organization 또는 user에 설치되어 있어야 합니다. entitlement form에서 GitHub card의 Disconnect를 클릭한 다음 Connect GitHub를 클릭하여 app을 다시 설치하고, gate하려는 repository에 대한 access를 부여합니다.
Grant fails with a permission error
GitHub App의 installation이 더 이상 repository에 액세스할 수 없거나 repository의 이름이 변경되었거나 이전되었습니다. App에 repository 액세스 권한을 다시 부여하면 다음 regrant가 성공합니다.
Customer hasn't accepted the invite
고객은 GitHub 알림 또는 GitHub 초대 이메일의 링크를 통해 GitHub 초대를 수락합니다. 수락하기 전에는 초대된 상태이지만 repository를 clone할 수 없습니다. Dodo Payments에서 grant는 여전히 Delivered 상태입니다. Dodo Payments가 발급하는 것은 초대이기 때문입니다.