import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
bluesnap: {
type: "app",
app: "bluesnap",
}
},
async run({steps, $}) {
const data = { //Sample payload
"amount": 3500.00,
"currency": "USD",
"cardTransactionType": "AUTH_CAPTURE",
"cardHolderInfo": {
"firstName": "Test",
"lastName": "User",
"zip": "12345"
},
"creditCard": {
"expirationYear": 2025,
"expirationMonth": "12",
"cardNumber": "4111111111111111",
"securityCode": "123"
}
}
return await axios($, {
method: "post",
url: `${this.bluesnap.$auth.api_url}/services/2/transactions`,
headers: {
"content-type": `application/json`,
"bluesnap-version": `3.0`,
"accept": `application/json`,
},
auth: {
username: `${this.bluesnap.$auth.username}`,
password: `${this.bluesnap.$auth.password}`,
},
data,
})
},
})
BlueSnap uses API keys for authentication. When you connect your BlueSnap account, Pipedream securely stores the keys so you can easily authenticate to BlueSnap APIs in both code and no-code steps.
To create your API Credentials - API User Key, Password and Default Store ID sign in to Merchant Portal and go to Settings > API Settings.