Skip to content

Conversation

@BlairCurrey
Copy link
Contributor

@BlairCurrey BlairCurrey commented Dec 4, 2025

Description of changes

Adds docs/snippets for go sdk

I had to wrestled with prettier quite a bit but I think its all cleaned up.

fixes #741

Required

  • Used LinkOut component on external links
  • Reviewed Vale errors and made changes where appropriate
  • Ran Prettier
  • Previewed updates in Netlify
  • Received SME and/or peer approval if updates are significant
  • Included a "fixes #" comment

Conditional

  • Ensured sequence diagrams follow our style guide
  • Included code samples where appropriate
  • Updated related READMEs

@netlify
Copy link

netlify bot commented Dec 4, 2025

Deploy Preview for openpayments-preview ready!

Name Link
🔨 Latest commit 0aa6f8c
🔍 Latest deploy log https://app.netlify.com/projects/openpayments-preview/deploys/69612e4e8c35c70008b36d22
😎 Deploy Preview https://deploy-preview-735--openpayments-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@BlairCurrey BlairCurrey changed the title feat: add wallet address initial snippets feat: add go snippets Dec 4, 2025
<TabItem label='Go' icon='seti:go'>

```go wrap
combinedQuoteAmount := "10000" // merchantQuote.DebitAmount.Value + platformQuote.DebitAmount.Value
Copy link
Contributor Author

@BlairCurrey BlairCurrey Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This deviates from the TS/Rust version but I felt like this was clearer than parsing/summing the previous values.

Also, is the ts version correct?

  const combinedQuoteAmount = quote1.debitAmount.value + // '9900'
                              quote2.debitAmount.value // '100'

Not sure if these are strings or big ints. Client might convert them to big ints. Or it might resolve to '9900100'.

This is how it might look (similar to Rust) if it actually parses correctly (but I thought what I had is sufficient):

merchantValue, err := strconv.ParseInt(merchantQuote.DebitAmount.Value, 10, 64)
if err != nil {
  log.Fatalf("invalid merchant amount: %v", err)
}

platformValue, err := strconv.ParseInt(platformQuote.DebitAmount.Value, 10, 64)
if err != nil {
  log.Fatalf("invalid platform amount: %v", err)
}

combinedQuoteAmount := strconv.FormatInt(merchantValue+platformValue, 10)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I think the TS version would just concatenate the strings. We can go with the method you presented since it's more obvious.
Can you also please update the TS one to be just
combinedQuoteAmount = '1000' // 9900 + 100

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or are they actually bigints? Anyways, I think combinedQuoteAmount = '10000' // 9900 + 100 is clearer. changed to that.

@BlairCurrey BlairCurrey marked this pull request as ready for review December 16, 2025 02:58
if err := outgoingPayload.FromCreateOutgoingPaymentWithQuote(rs.CreateOutgoingPaymentWithQuote{
WalletAddressSchema: *customerWalletAddress.Id,
QuoteId: *customerQuote.Id,
}); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}); err != nil {
}); if err != nil {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happens in a few guides other guides, just needs a find+replace

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}); if err != nil { is a syntax error: syntax error: unexpected keyword if, expected expression

can check out this example: https://go.dev/play/p/BPjtuPgQ-AO. If you replace it with the original }); err != nil { you should see that it works.

So I think it's fine as-is but to keep with your direction, it could be un-compacted a bit to this:

	err := outgoingPayload.FromCreateOutgoingPaymentWithQuote(
		CreateOutgoingPaymentWithQuote{
			WalletAddressSchema: *customerWalletAddress.Id,
			QuoteId:             *customerQuote.Id,
		},
	)
	if err != nil {
		log.Fatalf("Error creating payload: %v\n", err)
	}

Comment on lines 756 to 760
senderOutgoingPaymentGrant, err := client.Grant.Continue(context.TODO(), op.GrantContinueParams{
URL: pendingSenderOutgoingPaymentGrant.Continue.Uri,
AccessToken: pendingSenderOutgoingPaymentGrant.Continue.AccessToken.Value,
InteractRef: INTERACT_REF,
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor, on the preview link, InteractRef: INTERACT_REF, is indented differently than URL AccessToken

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines +185 to +187
<TabItem label='Go' icon='seti:go'>
```go wrap
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page's snippets have an extra starting indent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

AssetCode: "CAD",
AssetScale: 2,
},
}); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}); err != nil {
}); if err != nil {

Limits: &limits,
}
outgoingAccessItem := as.AccessItem{}
if err := outgoingAccessItem.FromAccessOutgoing(outgoingAccess); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if err := outgoingAccessItem.FromAccessOutgoing(outgoingAccess); err != nil {
if err := outgoingAccessItem.FromAccessOutgoing(outgoingAccess); if err != nil {

<TabItem label='Go' icon='seti:go'>

```go wrap
combinedQuoteAmount := "10000" // merchantQuote.DebitAmount.Value + platformQuote.DebitAmount.Value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I think the TS version would just concatenate the strings. We can go with the method you presented since it's more obvious.
Can you also please update the TS one to be just
combinedQuoteAmount = '1000' // 9900 + 100

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not update the spec version yet (since we don't want to show grant spent amounts API being available before have the docs for the grant spent amount feature).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont remember exactly what commit we were on before, and I didn't figure out a clean way to revert, so I changed it to the previous commit (41ea94b (tag: v1.1.1) fix: resource server signature spec (#21)) which I think should be fine (and possibly what it was before).

@BlairCurrey BlairCurrey mentioned this pull request Jan 7, 2026
2 tasks
@BlairCurrey BlairCurrey requested a review from mkurapov January 7, 2026 19:55
@BlairCurrey BlairCurrey merged commit 62bf7ac into main Jan 9, 2026
5 checks passed
@BlairCurrey BlairCurrey deleted the blair/gol-16 branch January 9, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOCS] Add GoLang SDK Snippets

4 participants