멜로투모로
멜로투모로4mo ago

Brand Pay Implementation Inquiry

Hi, We are a foreign business trying to make a shop in Korea. Google Translate did not seem to work in correctly translating the steps to the implementation. We are confused about the part of applying a redirect URI. We have the widget visible on our site (melotomorrow.com) but after inputting the card information, the widget spits out: "Uncaught (in promise) Error: The redirect URL is not registered. Please register on the development information page." We can speak a little Korean but not to the extent of following the guide. Thank you for your assistance.
65 Replies
Ayaan
Ayaan4mo ago
Good morning @멜로투모로, thank you for reach us. Unfortunately, our english documentation is quite limited, so we agree that you can get confusing at some point. You mentioned that Redirect URI setting part is confusing now, can you share little bit more about where you confusing now? Just to explain what we understand, redirectUrl must first be registered in our admin page. Otherwise you will get the same error as you got before. Thank you for using Toss Payments' service!
멜로투모로
멜로투모로4mo ago
Thank you so much for the reply! We understand that we have to register the redirectURL on our admin page. We don't understand what the redirect URL is and how to implement it in our code. On a side note, our company does not have a login function, so items are all purchased without logging in.
Ayaan
Ayaan4mo ago
Just for note, Brandpay is not suitable for websites that do not use a login process. So you may need to use different product of Tosspayments such as paymentWindow or paymentWidget.
Ayaan
Ayaan4mo ago
Redirecturl is needed for this process.
No description
Ayaan
Ayaan4mo ago
When the customer clicks the payment button on the website, they will be redirected to the Tosspayments website. After authorization is processed on the Tosspayments website, it will be redirected to you again for confirmation, DB logic, and other processing. At this time, you will need a Redirect URI that must be registered on the admin page. This is similar to how Oauth2.0 works.
멜로투모로
멜로투모로4mo ago
HI, we really need to start selling by the 31st. If we apply for paymentWindow or paymentWidget, would we be able to access the functions by then? Again, thank you so much for your assistance
멜로투모로
멜로투모로4mo ago
Also, with this brand pay, do we need to make our own authorization? We tried setting the redirect URI to https://google.com just to test it out, and it spit out this:
Google
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
멜로투모로
멜로투모로4mo ago
No description
Ayaan
Ayaan4mo ago
Let me explain which endpoint is needed. 1. Callback URL(Authorization Endpoint, as known as RedirectUrl) When a customer registers a payment method in the payment UI and agrees to the terms and conditions, they are redirected to the redirect URL registered in the developer center. Learn more When it redirects to callback URL, a temporary authentication code and customerKey are returned, as follows: https://{CALLBACK_URL}/?code={CODE}&customerKey={CUSTOMER_KEY} code: Authorization Code (temporary authentication code) required to issue an Access Token. It expires in 5 minutes. customerKey: The customer's unique ID created by your store (as known as user ID). As soon as you got authorization code and customerKey, you need to call our token endpoint (https://api.tosspayments.com/v1/brandpay/authorizations/access-token) which defined on OAuth 2.0 RFC rule. Learn more e.g.)
curl --request POST \
--url https://api.tosspayments.com/v1/brandpay/authorizations/access-token \
--header 'Authorization: Basic ENCODED_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data '{"grantType":"AuthorizationCode","customerKey":"CUSTOMER_KEY","code":"AUTHORIZATION_CODE"}'
curl --request POST \
--url https://api.tosspayments.com/v1/brandpay/authorizations/access-token \
--header 'Authorization: Basic ENCODED_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data '{"grantType":"AuthorizationCode","customerKey":"CUSTOMER_KEY","code":"AUTHORIZATION_CODE"}'
After your shop's server calls our token endpoint, you will get Access Token and Refresh Token as follows:
{
"accessToken": "ACCESS_TOKEN",
"refreshToken": "REFRESH_TOKEN",
"tokenType": "Bearer",
"expiresIn": 2592000
}
{
"accessToken": "ACCESS_TOKEN",
"refreshToken": "REFRESH_TOKEN",
"tokenType": "Bearer",
"expiresIn": 2592000
}
The SDK now automatically checks and uses the paying customer's Access Token. 2. Success URL(Success Confirm Endpoint) If the Access Token is successfully issued and the payment request is successful, it moves to the successUrl set as a parameter of requestPayment(). There are four query parameters after successUrl. The first parameter is paymentType. Since it is a Brand Pay payment, it returns to BRANDPAY. e.g.) https://{SUCCESS_URL}/?paymentType=BRANDPAY&paymentKey={PAYMENT_KEY}&orderId={ORDER_ID}&amount={AMOUNT} * paymentType: Payment type. Brand Pay payments are always BRANDPAY. * paymentKey: The key value of the payment. This is a unique value that identifies the payment. Payment data must be saved for management purposes. The value is maintained even if the payment status changes. Used for payment authorization. * orderId: Order ID. It serves to identify the ordered payment. It is a value created by the affiliated store and sent in requestPayment() when requesting payment. Payment data must be saved for management purposes. Must issue unique, non-duplicate values. The value is maintained even if the payment status changes. * amount: The amount actually paid. When it redirects to success URL and paymentType is BRANDPAY, call BrandPay confirm endpoint (https://api.tosspayments.com/v1/brandpay/payments/confirm). Learn more e.g.)
curl --request POST \
--url https://api.tosspayments.com/v1/brandpay/payments/confirm \
--header 'Authorization: Basic ENCODED_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data '{"paymentKey":"PAYMENT_KEY","amount":AMOUNT,"customerKey":"CUSTOMER_KEY","orderId":"ORDER_ID"}'
curl --request POST \
--url https://api.tosspayments.com/v1/brandpay/payments/confirm \
--header 'Authorization: Basic ENCODED_SECRET_KEY' \
--header 'Content-Type: application/json' \
--data '{"paymentKey":"PAYMENT_KEY","amount":AMOUNT,"customerKey":"CUSTOMER_KEY","orderId":"ORDER_ID"}'
When the Confirm Endpoint is successfully called, payment is completed. All you have to do is show the payment completion page to the user.
Ayaan
Ayaan4mo ago
If you decide to use paymentWindow or paymentWidget instead, you will need to make a contract again and change some code, so I don't think it will be able to start selling by the 31st. However, I suggest you use paymentWindow/Widget instead, as your business is unsuitable with brandpay. (Brand Pay is a service that provides SDK and API that allows stores to implement their own simple payments. If a buyer registers their card or account information once, they can easily make payments from then on. This means that your shopping mall must have the user's information on a permanent basis - a login process will be required.) For paymentWindow and Widget, English documentation is available. You can check out here: https://docs.tosspayments.com/en/integration-widget and https://docs.tosspayments.com/en/integration.
MrPeterss
MrPeterss4mo ago
for right now, is it ok to store the access token and regresh token in cookies? sounds like security risk we don't have time to implment full auth or should we just apply for the paymentWindow?
Ayaan
Ayaan4mo ago
You're using BrandPay SDK or PaymentWidget with BrandPay? Please check which js script are you including now. If your project uses React/Vue/etc, please check your package.json.
MrPeterss
MrPeterss4mo ago
payment widget with brand pay i’m using nextjs
Ayaan
Ayaan4mo ago
Then you don't need to store the access token and refresh token at all. (paymentWidget SDK will automatically gets/stores access_token in secured way) And if you want, you can simply change to regular payment product because you already using paymentWidget.
MrPeterss
MrPeterss4mo ago
GitHub
GitHub - tosspayments/payment-widget-sample: 토스페이먼츠 결제위젯 샘플 앱입니다.
토스페이먼츠 결제위젯 샘플 앱입니다. . Contribute to tosspayments/payment-widget-sample development by creating an account on GitHub.
MrPeterss
MrPeterss4mo ago
i’m following the nextjs example from this repo is this what you mean? i don’t know why we are getting the error
Ayaan
Ayaan4mo ago
This sample is for regular payment, not brandpay. you need to implement more to use brandpay which is I mentioned above.
MrPeterss
MrPeterss4mo ago
ok does it use the same widget though? is there a js example for the brand pay?
Ayaan
Ayaan4mo ago
No, not yet for PaymentWidget. You will need to read documentation and implement it. If you having trouble with understanding, please let me know, we will help you 🙂
MrPeterss
MrPeterss4mo ago
thank you what is the usage for this npm package?
MrPeterss
MrPeterss4mo ago
npm
@tosspayments/brandpay-sdk
TossPayments.js Brand Pay SDK. Latest version: 1.5.2, last published: 2 months ago. Start using @tosspayments/brandpay-sdk in your project by running npm i @tosspayments/brandpay-sdk. There is 1 other project in the npm registry using @tosspayments/brandpay-sdk.
MrPeterss
MrPeterss4mo ago
how can i initialize the brandpay we are still getting a 403 error I set up an api rout and added it to the developer center "Failed to load resource: the server responded with a status of 403"
Ayaan
Ayaan4mo ago
This library is for who aren't using PaymentWidget for Brandpay. If you want, you can use, but you need to re-implementing some lines of code. Please screenshot/copy from Devtools -> Network -> Response
토스페이먼츠 BOT
❤️ 기술문의 경험이 어떠셨나요?!
간단히 코멘트 남겨주세요! 제품 발전에 큰 힘이 됩니다.
MrPeterss
MrPeterss4mo ago
hi sorry what is the best way to go about implmeneting it then
Ayaan
Ayaan4mo ago
Do you still want to use Brandpay? Do you have any contracts for Brandpay? Then, it is up to you. If you don't have contracts for Brandpay but you want to use Tosspayments, use Regular PaymentWidget and make contract.
MrPeterss
MrPeterss4mo ago
we are still using brandpay
Ayaan
Ayaan4mo ago
oh no, you are mixing with different SDK. That's why you got the error.
MrPeterss
MrPeterss4mo ago
the weird thing is its working just payment is not getting taken like it gets all the way to the end i don't know what sdk to use there are too many sdks
Ayaan
Ayaan4mo ago
Yes, because it is a completely different SDK. So let's clarify.
MrPeterss
MrPeterss4mo ago
yes please
멜로투모로
멜로투모로4mo ago
we don't get any toss related errors till the end everything payment related goes through
MrPeterss
MrPeterss4mo ago
first we should understand what sdk we have to use we are using brandpay and i would prefer to use the widget because i don't want to implment it fully myself i don't have the time for that right now
Ayaan
Ayaan4mo ago
Yes, just give me a sec.
MrPeterss
MrPeterss4mo ago
thhank you for your help
Ayaan
Ayaan4mo ago
* Does your shop have a login process? * If so, Do you know what Brandpay is? * Do you still want to use Brandpay? * Use PaymentWidget SDK to implement Brandpay (this is a new SDK) * If not, Do you want to make a normal transaction? * Use PaymentWidget SDK for regular transaction In both choice, you have to use @tosspayments/payment-widget-sdk.
MrPeterss
MrPeterss4mo ago
ok we want the second option we don't have a login ok we only have access to brand pay at this moment, so how can i ensure we are using the payment-widget-sdk with brandpay?
Ayaan
Ayaan4mo ago
Once you integrate with PaymentWidget first, you can access our admin page(dashboard.tosspayments.com) In admin page, you can access payment UI Setup - You can setup your brandpay integration on there
MrPeterss
MrPeterss4mo ago
so is it safe to follow this nextjs example. because previously you said it wasn't https://github.com/tosspayments/payment-widget-sample/tree/main/nextjs
GitHub
payment-widget-sample/nextjs at main · tosspayments/payment-widget-...
토스페이먼츠 결제위젯 샘플 앱입니다. . Contribute to tosspayments/payment-widget-sample development by creating an account on GitHub.
Ayaan
Ayaan4mo ago
Yes if you want to drop Brandpay support, please use this sample.
MrPeterss
MrPeterss4mo ago
but i believe we only have access to brandpay we don't have the other
Ayaan
Ayaan4mo ago
Do you have a brandpay contract?
MrPeterss
MrPeterss4mo ago
yes
Ayaan
Ayaan4mo ago
Ah, can I see your merchant ID? It will starts with cp_....
멜로투모로
멜로투모로4mo ago
cp_melrotzjti
MrPeterss
MrPeterss4mo ago
^
Ayaan
Ayaan4mo ago
Ok, thanks. I got it. Ah... then You may need to make login process
MrPeterss
MrPeterss4mo ago
crap
Ayaan
Ayaan4mo ago
No description
Ayaan
Ayaan4mo ago
This means you should have a user identifier; it should be unique and shouldn't be changed for one customer; It means you have to make login process or identify verification process.
MrPeterss
MrPeterss4mo ago
we are not in the best spot to be implmenting full auth right now should we apply for the other one?
Ayaan
Ayaan4mo ago
For contracts, to be honest, we don't know; it is entirely up to you. I am sorry for saying this, because you don't have a time for open your service, but you need to ask our contract team to clarify.
MrPeterss
MrPeterss4mo ago
thats ok we can push the date but we still have to solve this asap what would you recomend? full auth? i can do it it will just be a pain
Ayaan
Ayaan4mo ago
I think you need to choose the correct product that is suitable for your business. I think Brandpay is not a good idea for you, but I am not a sales team, so I cannot give you a sure answer.
MrPeterss
MrPeterss4mo ago
the way i solved the "user identifier" problem was i just assigned a new random id and store it in the cookies of the site
Ayaan
Ayaan4mo ago
No, it should be stores on your DB.
MrPeterss
MrPeterss4mo ago
ok its probably best for us to just apply to the other thank you for the help
Ayaan
Ayaan4mo ago
Not exactly, I suggest you to email or call our sales team.
멜로투모로
멜로투모로4mo ago
It's okay we applied for the other one thank you for your help
Ayaan
Ayaan4mo ago
Because the user identifier is used for getting pre-registered Card, Bank Accounts, and User Personal Data, it shouldn't be changed, so the cookie is too dangerous.
MrPeterss
MrPeterss4mo ago
that makes sense
Ayaan
Ayaan4mo ago
Cool, just for note, if you need to talk with the sales team: enterprise-sales@tosspayments.com OR +82-02-1544-7772 (Calls Korean Only) If you need to talk with the contract team: contract@tosspayments.com OR +82-02-1544-7772 (Calls Korean Only)
토스페이먼츠 BOT
토스페이먼츠 결제연동팀
빠르고 정확한 결제연동 경험을 위해, 디스코드에서는 기술 문의만 받고 있습니다. 계약 및 운영 관련 문의는 1544-7772나 홈페이지 상담을 이용해주세요. 감사합니다.
Ayaan
Ayaan4mo ago
Because this channel is tech team only, so to be honest, we are limited for answer your problem. We apologize for confusing you with the product and SDK; I promise it will be improved later. If you applied for regular payment, you can use this sample: https://github.com/tosspayments/payment-widget-sample Docs: https://docs.tosspayments.com/en/index
More Posts
토스페이먼츠 결제 취소/환불 영수증 내역 확인 케이스 문의안녕하세요 담당자님~ 결제 완료/취소/환불 에 대하여 영수증 확인하기 버튼을 눌렀을 때 영수증을 확인하지 못하는 케이스가 있는지 확인이 필요하여 여쭤봅니다. 토스페이먼츠 위젯을 추가 약관 생성 시 variant key 수정 이슈추가 약관 생성 후 variant key 를 AGREEMENT_EN 으로 설정하려고 AGREEMENT까지 입력하니 해당 input이 비활성 되는 버그가 있습니다. default값결제위젯 문의 드립니다.안녕하세요, 결제위젯을 사용하려고 하는데요. (국내, 해외 카드) 테스트 위젯에서 상세 설정을 들어가려면 일시적 오류가 발생했다는 메시지가 뜹니다. 어떻게 해야할까요?Paypal 결제 통화paypal 가이드 문서를 확인했더니, 결제 통화가 현지 통화로 나와있는데 JPY도 지원하시나요?m006 error안녕하세요, 현재 저희 쇼핑몰은 iOS 네이티브 앱에서 ShopBy에서 제공해주는 ncp_pay를 활용하여 xpay를 연동하고있습니다. 저번에 유선상으로 여줘 봤을때 심사가 진행안녕하세요. 개발 연동 중 오류에 대한 문의 드립니다.에러 응답코드 : {"code":"UNAUTHORIZED_KEY","message":"인증되지 않은 시크릿 키 혹은 클라이언트 키 입니다.","data":null} 현재 라이브 에러 메세지 중 블랙리스트현재 브랜드페이 이용중 고객 한분이 어제부터 '블랙리스트' 라는 에러메세지를 받고 결제 진행이 계속 안되고 있다하는데 저희 내부에서는 핸들링하는 메세지내용이 아니라서 브랜드페이에paymentKey로 검색시 현금영수증 조회현금 영수증 정보를 저장하고 싶은데 paymentKey로 결제 성공된 건을 조회시 2022-06-08 번에서 조회가 가능할까요? 현재 문서에는 Payment 응답 객체에 담긴다결제 시 예전 사업자명으로 표시됩니다.회사명 변경 전에 토스페이먼츠 계약 등을 마쳤고, 이후에 회사명을 변경했습니다. 그런데 결제 테스트 시 사업자 이름이 변경 전 이름으로 표시되어 문의 드립니다. 상점 - 계약안녕하세요 인증서버 500 에러 코드 반환 문의드립니다임시토큰 콜받받은후 인증서버로 전달하니 500 내부서버 오류 코드를 서버에서 반환합니다 .NET 서버로 BE 작성중이며, 아래와 같이 호출하는데 재가 잘못 호출하는것인지 문의드립