Coder Social home page Coder Social logo

alipay-request-node's Introduction

alipay-request

alipay-api-sdk for alipay'doc(click here)


#use

>cd your-project
>npm install alipay-request --save

#easy Example

const fs = require("fs");
const path = require("path");
const AlipayRequest = require('alipay-request');

//-----------------Iint AlipayRequest----------------------
let alipayRequest =  new AlipayRequest();
alipayRequest.gateWayUrl = 'https://openapi.alipay.com/gateway.do';
alipayRequest.rsaPrivateKey=path.join(__dirname,'key','rsa_private_key.pem');
alipayRequest.alipayrsaPublicKey=path.join(__dirname,'key','alipay_public_key.pem');
alipayRequest.initParam();//every request must initParam
//------------------SET sendParam-------------------
alipayRequest.setParam('app_id','2016080308888888');
alipayRequest.setParam('biz_content',JSON.stringify({bill_type:'trade',bill_date:alipayRequest.getYmdFormatDate(-24*3600*1000)}));//get data,yesterday
alipayRequest.setParam('charset','utf-8');
alipayRequest.setParam('format','json');
alipayRequest.setParam('method','alipay.data.dataservice.bill.downloadurl.query');
alipayRequest.setParam('sign_type','RSA');
alipayRequest.setParam('version','1.0');
alipayRequest.setParam('timestamp',alipayRequest.getNowFormatDate());
//这个必须是最后一个参数 sign must be last param
alipayRequest.setParam('sign',alipayRequest.getSign());
//------------------Get result-------------------
alipayRequest.getRes()
.then((res)=>{
    let backRes = JSON.parse(res.body);
    console.log(backRes);
})
.catch((err)=>{
    console.log(err);
});

alipay-request-node's People

Contributors

zy445566 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

cuiopen chenjiaok

alipay-request-node's Issues

中文subject问题

请问你使用nodejs提交订单的时候 subject带中文的情况下 签名后 支付宝服务器会不会返回签名失败

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.