Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

測試時使用本地網址ReturnURL錯誤 #1

Closed
Jimmy1186 opened this issue Sep 29, 2022 · 3 comments
Closed

測試時使用本地網址ReturnURL錯誤 #1

Jimmy1186 opened this issue Sep 29, 2022 · 3 comments

Comments

@Jimmy1186
Copy link

Jimmy1186 commented Sep 29, 2022

ReturnURL使用本地網址 "http://localhost:3000/" 會產生錯誤訊息。
使用NextJS
後端用tRPC 和 RESTAPI 都出現一樣問題。
換回用官方的是ok可以用,
我嘗試以下方法:

const newM = new Merchant("Test", options);

const options = {
....
 ReturnURL:`${process.env.API_URL}paySuccess`, //API_URL=http://localhost:3000,
OR...
 ReturnURL:`http://localhost:3000/paySuccess`,
}

catch出來的錯誤:

 value: {
    ...,
    ReturnURL: 'http://localhost:3000/paySuccess',

  },
  path: 'ReturnURL',
  type: 'url',
  errors: [ 'ReturnURL must be a valid URL' ],
  params: {
    value: 'http://localhost:3000/paySuccess',
    originalValue: 'http://localhost:3000/paySuccess',
    label: undefined,
    path: 'ReturnURL',
    regex: /^((https?|ftp):)?\/\/.......?)*)?$/i
  },
  inner: [],
  page: '/api/PaymentDoneServer'
}

版本:0.2.2

@simenkid
Copy link
Owner

simenkid commented Sep 30, 2022

@Jimmy1186 關於這一點是因為 ReturnURL 驗證時 yup 對 url 的 scheme 不接受 localhost。不過就我的認知,ReturnURL 不是 webhook 嗎?這個 hook 掛在 localhost,接得到綠界送回的付款結果喔?(我自己沒試過~)

我稍後會更新一下 package 到 v0.2.3,您再試試~

@simenkid
Copy link
Owner

@Jimmy1186 已更新,再麻煩試試看,3Q~

@Jimmy1186
Copy link
Author

@Jimmy1186 已更新,再麻煩試試看,3Q~
感謝你的回覆,沒問題了。

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

No branches or pull requests

2 participants