Skip to content
New issue

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

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

Already on GitHub? # to your account

Support for ejs import #58

Closed
RobyCigar opened this issue Mar 4, 2023 · 2 comments
Closed

Support for ejs import #58

RobyCigar opened this issue Mar 4, 2023 · 2 comments
Labels
question Further information is requested

Comments

@RobyCigar
Copy link

RobyCigar commented Mar 4, 2023

Hi, thanks for the library, currently i have problem with the import statement
how can I import the package using ejs syntax in my client?
import snap from 'midtrans-client'
currently the available docs only explain about common js import
const blah = require('midtrans-client')
thank you

@Andrenzo17
Copy link
Collaborator

Hi @RobyCigar do you mean this is for client side is front end?
This library/package is mainly NOT FOR FRONTEND (Browser's javascript) usage, but for backend (Node JS server) usage:

  • This is mainly for backend usage, to do secure server-to-server/backend-to-backend API call.
  • You may/will encounter CORS issue if you are using this to do API request from frontend.
  • Your API ServerKey may also be exposed to public if you are using this on frontend.
  • If what you need is to display Snap payment page on your frontend, please follow this official documentation

Thank you

@Andrenzo17 Andrenzo17 added the question Further information is requested label Mar 7, 2023
@RobyCigar
Copy link
Author

RobyCigar commented Mar 7, 2023

thanks for your reply @Andrenzo17
sorry I thought the word client in "midtrans-nodejs-client" mean its for the client(frontend)

Initially i was looking for snap npm package, the docs said i should add inline script in my html, but i feel like its not a proper way to add package directly using inline script in my project, i would rather using npm than inline script, so i stumbled to this repo.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants